r/ProgrammerHumor 2d ago

Meme bugIntroducedDebugging

Post image
1.1k Upvotes

120 comments sorted by

View all comments

Show parent comments

4

u/bloody-albatross 2d ago edited 2d ago

I read it as the size of the pointer being 4 bytes, but now I see you were referring to the int. AFAIK the size of int is specified as "at least" 32 bit in the C standard, and all 32 and 64 bit platforms I know indeed use 32 bit. Though the size of long (not speaking of long long) is different on different 64 bit platforms, IIRC. Windows uses 32 bit and Linux uses 64. Both use 64 for long long. I prefer to use (u)int*_t when I need to be sure about the size and I use int/size_t/time_t/... when I interface with functions that use those in their signature.

7

u/MattieShoes 2d ago

AFAIK the size of int is specified as "at least" 32 bit in the C standard

I believe it's 16 bit, though you're not likely to encounter a 16 bit int today unless it's a microcontroller or something.

3

u/SeriousPlankton2000 2d ago

Yes, long is 32 bit. A long long time ago we didn't need long long yet. I can still remember.

3

u/bloody-albatross 2d ago

Under 64 bit Windows. Under 64 bit Linux long is 64 bit. Don't know about macOS or other OSes. :D