Re: Compiler code gen
"Brett Bibby" <[email protected]> Wed, 1 Dec 2004 07:55:48 +0800
| Newsgroups | gmane.games.devel.windows |
|---|---|
| Organization | GameBrains |
| Message-ID | <[email protected]> |
Doh! Not very many holes, but one new one. My gripe with CodeWarrior is that it recognizes the float being passed and promotes it to double from the caller, then I try to retrieve it with the type float and obviously it knows that it must promote that to double but doesn't. I'm not sure it's a standard problem as much as their implementation of the va_arg function. Brett ----- Original Message ----- From: "Jon Watte" <[email protected]> To: <[email protected]> Sent: Wednesday, December 01, 2004 6:06 AM Subject: RE: [GD-Windows] Compiler code gen > >> I guess his point is that va_arg(ap, float) as defined is always going to > do >> the wrong thing because variable argument lists can never contain floats. > I >> don't know how that could be fixed, considering that va_arg() is > essentially >> a macro hack created to avoid adding language constructs. > > In C++, you could catch that use with a compile-time assert. > > In both C and C++ you can actually pass floats by using unions, and/or > type punning. Thus, being able to specify float as the argument for > va_arg() isn't entirely useless -- but, as many things, may cause hole > in the feet of previously inexperienced programmers. > > Corollary: experience is directly proportional to the number of holes > in your feet, thus more experienced programmers walk slower. > > Cheers, > > / h+ > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > Gamedevlists-windows mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ Gamedevlists-windows mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=555