vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Mon, 16 May 2005, Han Boetes wrote: > > If sizeof returns size_t, and size_t is typedefed as unsigned > > int, according to the implicit expression casting rules, int > > _will_ be cast into unsigned when compared to an unsigned > > number. > > Fascinating stuff. I googled a bit for implicit casting and I > found this: > > http://www.peroxide.dk/download/tuto.../chapter6.html > > > Which goes a bit deeper into the subject. Well, I prefer the description in K&R 2nd edition, section A6, and especially A6.5. It contains everything you need and is likely to contain less errors than some random page found on the internet. Understanding the arithmetic conversion rules is a prerequisite to decent C programming. One extra thing: do not assume that sizeof(int) == sizeof(size_t). It will hit you big time on 64-bit archs. -Otto |