3 ms·
> these days is usually seen as bad programming I've seen this repeatedly told again and again, however people saying that don't really know what they are talk
by bad_user 14y ago
> these days is usually seen as bad programming
I've seen this repeatedly told again and again, however people saying that don't really know what they are talking about - it's extremely easy to make assumptions without even realizing you're making one, even if you could recite the whole spec of C and C++.
Even more, in C and C++ it is inevitable to make assumptions, even with eternal vigilance. I want you to point to a single reasonably big application that doesn't make such assumptions. And please don't point to one that works on both 32-bits and 64-bits, as in those cases the assumption about Ints simply evolved to: either 4 bytes or 8 bytes, with some awful code out in the wild that only works because of conditional compilation ... sometimes I wonder how software I rely upon works at all.
- keeperofdakeys 14y agoWell the biggest thing you need to do is not use ints to store pointers, and use things like size_t, etc. This accounts for the majority of C programming bugs when moving from 32 bits to 64 bits. As for making assumptions, this is only natural, and programmers should be aware of the basic differences so they can correct their assumptions.