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

LOBYTE (0400): Overflow in constat expression

12 views
Skip to first unread message

kzelec...@e3tech.local

unread,
Apr 23, 2013, 4:58:05 AM4/23/13
to
1. What is "constat expression"?
2. The warning is bogus and quite disconcerting; you cannot tell actual
issues from fake ones.
I can live with the fact that ((BYTE) (0400)) produces a warning because it
is a cast and a narrowing cast is a bad thing; however, (LOBYTE (0400))
should not.
It works if I use (0400 & UCHAR_MAX) instead but LOBYTE is a Microsoft macro
and it should be useful as it is.

jacob navia

unread,
Apr 23, 2013, 12:29:48 PM4/23/13
to
Le 23/04/13 10:58, kzelec...@e3tech.local a écrit :
The problem is that LOBYTE makes FIRST a cast to BYTE with

(BYTE) 0x400

This is wrong since the value doesn't fit into a byte (0-255) The
warning is correct. Then, the LOBYTE macro makes a & 0xff.

To avoid this warning do:

#undef LOBYTE
#define LOBYTE(x) (x&0xff)


kzelec...@e3tech.local

unread,
Apr 24, 2013, 2:11:55 AM4/24/13
to
Wouldn’t it be more appropriate to fix LOBYTE in the header file than make
all clients do it separately?

Użytkownik "jacob navia" napisał w wiadomości grup
dyskusyjnych:kl6cto$8sd$1...@speranza.aioe.org...
0 new messages