Click here to Skip to main content
15,885,365 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: I need socket help UDP broadcast, sendbuf Pin
Albert Holguin20-Oct-11 11:31
professionalAlbert Holguin20-Oct-11 11:31 
GeneralRe: I need socket help UDP broadcast, sendbuf Pin
jkirkerx20-Oct-11 12:39
professionaljkirkerx20-Oct-11 12:39 
GeneralRe: I need socket help UDP broadcast, sendbuf Pin
jkirkerx20-Oct-11 12:46
professionaljkirkerx20-Oct-11 12:46 
GeneralRe: I need socket help UDP broadcast, sendbuf Pin
Albert Holguin21-Oct-11 4:51
professionalAlbert Holguin21-Oct-11 4:51 
GeneralRe: I need socket help UDP broadcast, sendbuf Pin
jkirkerx21-Oct-11 6:52
professionaljkirkerx21-Oct-11 6:52 
AnswerYou have to use the memset Pin
jkirkerx20-Oct-11 11:05
professionaljkirkerx20-Oct-11 11:05 
AnswerRe: You have to use the memset Pin
Albert Holguin20-Oct-11 11:35
professionalAlbert Holguin20-Oct-11 11:35 
Question#define not const? Pin
Waldermort19-Oct-11 3:58
Waldermort19-Oct-11 3:58 
To make my code more readable I'm trying to use a set of defined values in a switch statement. Basically I have a 4 CHAR tag I want to convert to a DWORD.

C#
//#define _makeTag(a,b,c,d) ((#@a << 24) | (#@b << 16) | (#@c << 8) | #@d)
//#define tag_cmap    _makeTag(c,m,a,p)
#define _makeTag(x) ((#x[0] << 24) | (#x[1] << 16) | (#x[2] << 8) | #x[3])
#define tag_cmap    _makeTag(cmap)

In the above I have a 4 CHAR string "cmap" which in DWORD form should be 0x636d6170. However when using in a switch statement the compiler complains that it's not constant. The commented line works, however I believe it to be unreadable.

Any suggestions?

My previous method was to use a union but that required a loop over all the values, hence slow code.
Waldermort

AnswerRe: #define not const? Pin
TheGreatAndPowerfulOz19-Oct-11 5:14
TheGreatAndPowerfulOz19-Oct-11 5:14 
GeneralRe: #define not const? Pin
Waldermort19-Oct-11 5:48
Waldermort19-Oct-11 5:48 
AnswerRe: #define not const? Pin
«_Superman_»19-Oct-11 16:39
professional«_Superman_»19-Oct-11 16:39 
GeneralRe: #define not const? Pin
Waldermort20-Oct-11 1:42
Waldermort20-Oct-11 1:42 
GeneralRe: #define not const? Pin
«_Superman_»20-Oct-11 2:19
professional«_Superman_»20-Oct-11 2:19 
AnswerRe: #define not const? Pin
Stefan_Lang21-Oct-11 2:55
Stefan_Lang21-Oct-11 2:55 
QuestionPlaying video in particular dimensions Pin
VCProgrammer19-Oct-11 1:55
VCProgrammer19-Oct-11 1:55 
AnswerRe: Playing video in particular dimensions Pin
enhzflep19-Oct-11 2:35
enhzflep19-Oct-11 2:35 
QuestionCHtmlView and Windows 7 Pin
Member 810956018-Oct-11 22:57
Member 810956018-Oct-11 22:57 
QuestionTCP Communication Pin
john563218-Oct-11 19:15
john563218-Oct-11 19:15 
AnswerRe: TCP Communication Pin
Goto_Label_18-Oct-11 22:29
Goto_Label_18-Oct-11 22:29 
AnswerRe: TCP Communication Pin
Software_Developer18-Oct-11 22:56
Software_Developer18-Oct-11 22:56 
GeneralRe: TCP Communication Pin
john563218-Oct-11 23:45
john563218-Oct-11 23:45 
AnswerRe: TCP Communication Pin
App_18-Oct-11 23:07
App_18-Oct-11 23:07 
AnswerRe: TCP Communication Pin
jschell19-Oct-11 8:55
jschell19-Oct-11 8:55 
QuestionBeginPaint issues Pin
Waldermort18-Oct-11 9:08
Waldermort18-Oct-11 9:08 
AnswerRe: BeginPaint issues Pin
TheGreatAndPowerfulOz18-Oct-11 12:22
TheGreatAndPowerfulOz18-Oct-11 12:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.