in reply to: DWORD and bool to binary

A

ahso

Hi Balog. I can't reply there for some reasons.
Yes I changed << to < because I got some integer error. It compiles on
Windows but I want to compile on Linux so maybe i made a fault with
typedef:

typedef int DWORD;
typedef unsigned int WORD;
typedef long int LONG;
typedef int BYTE;
typedef bool LPVOID;

Many thanks
Michael
 
R

red floyd

ahso said:
[redacted]

Will you please stop posting the same message 7 times? USENET isn't
instantaneous. Just because you don't see your reply immediatly after
hitting "Post", doesn't mean it didn't go through.

And the comment someone else made still stands: If you're trying to
port code from one environment to another, you'd better damned well
know the intricacies of said code.

Not to mention that your LPVOID typedef is bogus.
 
C

Chris M. Thomasson

ahso said:
Hi Balog. I can't reply there for some reasons.
Yes I changed << to < because I got some integer error. It compiles on
Windows but I want to compile on Linux so maybe i made a fault with
typedef:

typedef int DWORD;
typedef unsigned int WORD;
typedef long int LONG;
typedef int BYTE;
typedef bool LPVOID;

More like:

http://msdn.microsoft.com/en-us/library/aa383751(VS.85).aspx
_________________________________________________________
typedef unsigned long DWORD;
typedef unsigned short WORD;
typedef long LONG;
typedef unsigned char BYTE;
typedef void* LPVOID;


typedef char windows_static_assert
[
sizeof(DWORD) * CHAR_BIT == 32 &&
sizeof(WORD) * CHAR_BIT == 16 &&
sizeof(LONG) * CHAR_BIT == 32 &&
sizeof(BYTE) * CHAR_BIT == 8
? 1 : -1
];
_________________________________________________________




Does that help?
 
B

Bo Persson

Chris said:
ahso said:
Hi Balog. I can't reply there for some reasons.
Yes I changed << to < because I got some integer error. It
compiles on Windows but I want to compile on Linux so maybe i made
a fault with typedef:

typedef int DWORD;
typedef unsigned int WORD;
typedef long int LONG;
typedef int BYTE;
typedef bool LPVOID;

More like:

http://msdn.microsoft.com/en-us/library/aa383751(VS.85).aspx
_________________________________________________________
typedef unsigned long DWORD;
typedef unsigned short WORD;
typedef long LONG;
typedef unsigned char BYTE;
typedef void* LPVOID;


typedef char windows_static_assert
[
sizeof(DWORD) * CHAR_BIT == 32 &&
sizeof(WORD) * CHAR_BIT == 16 &&
sizeof(LONG) * CHAR_BIT == 32 &&
sizeof(BYTE) * CHAR_BIT == 8
? 1 : -1
];
_________________________________________________________




Does that help?

It probably does, for some systems. The LONG type is very Windows
specific, so the definition is likely to fail on 64 bit Linux systems.


Bo Persson
 
C

Chris M. Thomasson

Bo Persson said:
Chris said:
ahso said:
Hi Balog. I can't reply there for some reasons.
Yes I changed << to < because I got some integer error. It
compiles on Windows but I want to compile on Linux so maybe i made
a fault with typedef:

typedef int DWORD;
typedef unsigned int WORD;
typedef long int LONG;
typedef int BYTE;
typedef bool LPVOID;

More like:

http://msdn.microsoft.com/en-us/library/aa383751(VS.85).aspx
_________________________________________________________ [...]
_________________________________________________________




Does that help?

It probably does, for some systems. The LONG type is very Windows
specific, so the definition is likely to fail on 64 bit Linux systems.

Indeed... Humm, well I guess the OP could try something crazy like this:
_____________________________________________________________
#if (UINT_MAX == 0xFFFFFFFFU)
# if ! defined (INT32)
typedef signed int int32;
typedef unsigned int uint32;
# endif
# define INT32
#endif


#if (ULONG_MAX == 0xFFFFFFFFU)
# if ! defined (INT32)
typedef signed long int32;
typedef unsigned long uint32;
# endif
# define INT32
#endif


#if ! defined (INT32)
# error there is no exact 32-bit integer.
#endif


typedef char windows_static_assert
[
sizeof(int32) * CHAR_BIT == 32 ? 1 : -1
];




typedef int32 LONG;
typedef uint32 ULONG;
_____________________________________________________________
 
C

Chris M. Thomasson

Paavo Helde said:
OP is wanting to compile on Linux, where most probably a proper
<stdint.h> header is present, so no need for such trickery.

#include <stdint.h>
typedef int32_t LONG;
typedef uint32_t ULONG;


good point!

:^)
 
I

Ian Collins

Chris said:
Indeed... Humm, well I guess the OP could try something crazy like this:

I don't think such guesswork will help an OP who looks totally lost!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top