Click here to Skip to main content
15,921,990 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: 32-bit or 64-bit, that's the question Pin
includeh105-Oct-03 4:29
includeh105-Oct-03 4:29 
GeneralRe: 32-bit or 64-bit, that's the question Pin
Steve S6-Oct-03 1:07
Steve S6-Oct-03 1:07 
GeneralRe: 32-bit or 64-bit, that's the question Pin
Terry O'Nolley5-Oct-03 7:07
Terry O'Nolley5-Oct-03 7:07 
GeneralRe: 32-bit or 64-bit, that's the question Pin
Bo Hunter5-Oct-03 7:38
Bo Hunter5-Oct-03 7:38 
GeneralRe: 32-bit or 64-bit, that's the question Pin
ZoogieZork5-Oct-03 7:23
ZoogieZork5-Oct-03 7:23 
GeneralRe: 32-bit or 64-bit, that's the question Pin
markkuk5-Oct-03 7:00
markkuk5-Oct-03 7:00 
GeneralRe: 32-bit or 64-bit, that's the question Pin
Michael Dunn5-Oct-03 9:11
sitebuilderMichael Dunn5-Oct-03 9:11 
QuestionDefining safe integer types? Pin
Dominik Reichl5-Oct-03 1:26
Dominik Reichl5-Oct-03 1:26 
Hello,

I am trying to define safe integer types. For example an UWORD8 should always be an 8-bit unsigned integer variable.

To define UWORD8, I tried this:

#if defined(__int8)
typedef unsigned __int8 UWORD8;
#elif (sizeof(char) == 1)
typedef unsigned char UWORD8;
#else
#error Cannot define an 8-bit unsigned integer type.
#endif

...

#if defined(__int64)
typedef unsigned __int64 UWORD64;
#elif (sizeof(int) == 8)
typedef unsigned int UWORD64;
#elif (sizeof(long) == 8)
typedef unsigned long UWORD64;
#elif (sizeof(long int) == 8)
typedef unsigned long int UWORD64;
#elif (sizeof(long long) == 8)
typedef unsigned long long UWORD64;
#else
#error Cannot define an 64-bit unsigned integer type.
#endif


But it doesn't compile. The compiler says:
fatal error C1017: invalid expression for integer constant,
always in the lines where I check the sizeof()s.

What am I doing wrong? How would you define safe integer variables? Any better way?

Confused | :confused:
Dominik



_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do?? Wink | ;)
(doesn't work on NT)

AnswerRe: Defining safe integer types? Pin
includeh105-Oct-03 4:08
includeh105-Oct-03 4:08 
AnswerRe: Defining safe integer types? Pin
Michael Dunn5-Oct-03 9:17
sitebuilderMichael Dunn5-Oct-03 9:17 
AnswerRe: Defining safe integer types? Pin
ZoogieZork5-Oct-03 9:26
ZoogieZork5-Oct-03 9:26 
GeneralI need high lights in Printing invoice(bell) Pin
Anonymous4-Oct-03 22:16
Anonymous4-Oct-03 22:16 
Generalneed advice on drawing code! Pin
coda_x4-Oct-03 21:05
coda_x4-Oct-03 21:05 
GeneralRe: need advice on drawing code! Pin
LunaticFringe4-Oct-03 22:05
LunaticFringe4-Oct-03 22:05 
GeneralRe: need advice on drawing code! Pin
coda_x4-Oct-03 23:37
coda_x4-Oct-03 23:37 
GeneralRe: need advice on drawing code! Pin
LunaticFringe5-Oct-03 3:55
LunaticFringe5-Oct-03 3:55 
GeneralRe: need advice on drawing code! Pin
coda_x6-Oct-03 1:34
coda_x6-Oct-03 1:34 
GeneralQuestion about several popular sleep methods. Pin
George24-Oct-03 19:46
George24-Oct-03 19:46 
GeneralRe: Question about several popular sleep methods. Pin
Blake Coverett4-Oct-03 20:53
Blake Coverett4-Oct-03 20:53 
GeneralRe: Question about several popular sleep methods. Pin
George24-Oct-03 21:27
George24-Oct-03 21:27 
GeneralRe: Question about several popular sleep methods. Pin
Blake Coverett4-Oct-03 21:53
Blake Coverett4-Oct-03 21:53 
GeneralRe: Question about several popular sleep methods. Pin
George24-Oct-03 22:00
George24-Oct-03 22:00 
GeneralRe: Question about several popular sleep methods. Pin
Johnny ²6-Oct-03 1:14
Johnny ²6-Oct-03 1:14 
GeneralRe: Question about several popular sleep methods. Pin
George26-Oct-03 16:39
George26-Oct-03 16:39 
Generalerror Pin
R. Thomas4-Oct-03 18:56
R. Thomas4-Oct-03 18:56 

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.