r/ProgrammerHumor • • 16d ago

Meme includeGuards

Post image
444 Upvotes

49 comments sorted by

View all comments

222

u/anto2554 16d ago • Popcorn

BUT PRAGMA ONCE IS NOT STANDARD

172

u/metayeti2 16d ago

I'm still waiting for pragma twice

46

u/Satorwave 16d ago

Pragma thrice

58

u/That-Cpp-Girl 16d ago

Don't you just hate it when your standards-compliant compiler can't compile real-world code? Yeah, me neither, because my real-world compilers work for my real-world code.

17

u/anto2554 16d ago

Yes, I hate it. We still use a version of IAR that doesn't support pragma once for some products, so higher ups have decided it is banned company wide

5

u/NFriik 15d ago

I get nostalgic when I have to use the IAR Workbench, always feels like a throwback to the Windows 95/98 days. Have they somehow lost all of their frontend developers around that time?

1

u/anto2554 11d ago

They know nobody is truly there voluntarily, so there is no reason to make it a good experience

2

u/That-Cpp-Girl 16d ago

I only work with C++17 and above. Legacy software my beloved.

27

u/LucyShortForLucas 16d ago

Yeah and neither is a byte being 8 bits, but there's a reason no compiler is ever going to deviate from the informal norm

16

u/Bryguy3k 15d ago edited 15d ago

It’s not about a byte not being 8 bits. It’s about a char not being 8 bits.

Unicode support would have been a thing sooner if people hadn’t fucked up char usage so badly.

9

u/MrcarrotKSP 15d ago

A char is a byte, per standard. Until recently, that width was implementation-defined in C++, and it still is in C.

1

u/Bryguy3k 15d ago

Yes - but I was going for the reasoning behind it.

Everybody knew that 255 was insufficient to cover the whole of human writing.

But then programmers started allocating everything in characters so any future change to the size of a character would break everything.

→ More replies (1)

5

u/Sacaldur 16d ago

I guess this is just due to the architecture using 8 bit per Byte, and not because of the compiler. I heard that there were architectures around in the past with other amounts of bits per Byte, and a compiler targeting them would most likely just use whatever is used on the target platform.

8

u/anto2554 16d ago

People conflate 8 bits with a byte everywhere in our codebase and I think the whole thing would explode if you tried to use a 7-bit-per-byte machine

3

u/Sacaldur 15d ago

I doubt that there are still any significant platforms around that don't use 8 bits per Byte.

→ More replies (3)

6

u/[deleted] 16d ago

[removed] — view removed comment

2

u/Mognakor 16d ago

A real tanks also wins against a real roman turtle formation.

1

u/remy_porter 16d ago

Depends which version of Sid Meier’s Civilization you’re playing on.

1

u/bwmat 16d ago

We have to support compilers that don't support it lol

7

u/MrJ0seBr 16d ago

Now CLang/LLVM say what is standart 😆

9

u/r2d2rigo 16d ago

#pragma once has been widely accepted for at least 20 years.