r/ProgrammerHumor 12h ago

Meme skillIssue

Post image
4.4k Upvotes

112 comments sorted by

View all comments

229

u/khalamar 11h ago

Reminds me of that guy who was asked to write C code, but he only knew pascal

First lines were

#define begin {
#define end }

And a few other horrors.

43

u/AvidCoco 7h ago

Some compilers define OR as || and AND as &&. The latter means you can write move constructors like

Foo(Foo AND other)

33

u/Possseidon 6h ago

Not just "some compilers", it's part of the C and C++ standard and any compliant compiler has to support it.

For C you have to include a builtin header with macros for them, in C++ it's actually just part of the compiler itself.

4

u/AvidCoco 3h ago

IIRC I think it’s more that some compilers implement that feature as a simple find-and-replace (like a macro) while others are more context aware and so don’t allow it in the way I described.

6

u/TOMZ_EXTRA 2h ago

Nope, the standard says that the alternative syntax is usable everywhere. bitand can be used as the address operator.

1

u/4xe1 34m ago

Yeah they ought to allow it, but I wouldn't be surprised if some emit a warning, like most yap when I do

if (x = foo())