Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: in reply to: DWORD and bool to binary

1 view
Skip to first unread message
Message has been deleted

red floyd

unread,
Nov 26, 2009, 1:36:10 PM11/26/09
to
ahso wrote:
> [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.

Chris M. Thomasson

unread,
Nov 26, 2009, 1:47:06 PM11/26/09
to
"ahso" <ahs...@yahoo.com> wrote in message
news:5e4c5ace-ba6b-4a51...@s31g2000yqs.googlegroups.com...
> 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?

Bo Persson

unread,
Nov 26, 2009, 4:19:06 PM11/26/09
to

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


Chris M. Thomasson

unread,
Nov 26, 2009, 4:43:53 PM11/26/09
to
"Bo Persson" <b...@gmb.dk> wrote in message
news:7n89m5F...@mid.individual.net...

> Chris M. Thomasson wrote:
>> "ahso" <ahs...@yahoo.com> wrote in message
>> news:5e4c5ace-ba6b-4a51...@s31g2000yqs.googlegroups.com...
>>> 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;
_____________________________________________________________

Paavo Helde

unread,
Nov 26, 2009, 6:02:08 PM11/26/09
to
"Chris M. Thomasson" <n...@spam.invalid> wrote in
news:8ECPm.12544$cX4....@newsfe10.iad:

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;

Paavo

Chris M. Thomasson

unread,
Nov 26, 2009, 6:15:30 PM11/26/09
to
"Paavo Helde" <myfir...@osa.pri.ee> wrote in message
news:Xns9CD0A91A...@216.196.109.131...

> "Chris M. Thomasson" <n...@spam.invalid> wrote in
> news:8ECPm.12544$cX4....@newsfe10.iad:
[...]

>>
>
> 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!

:^)

Ian Collins

unread,
Nov 26, 2009, 7:38:16 PM11/26/09
to
Chris M. Thomasson wrote:
>
> 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!

--
Ian Collins

0 new messages