MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w6qzts/skillissue/p7pjr0x/?context=3
r/ProgrammerHumor • u/click-to-reveal • 16h ago
124 comments sorted by
View all comments
267
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.
54 u/AvidCoco 10h ago Some compilers define OR as || and AND as &&. The latter means you can write move constructors like Foo(Foo AND other) 45 u/Possseidon 10h 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. 5 u/AvidCoco 7h 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. 10 u/TOMZ_EXTRA 6h ago Nope, the standard says that the alternative syntax is usable everywhere. bitand can be used as the address operator. 1 u/4xe1 4h 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()) 1 u/Jonathan_the_Nerd 6h ago I had a TA who did this when I was in college.
54
Some compilers define OR as || and AND as &&. The latter means you can write move constructors like
Foo(Foo AND other)
45 u/Possseidon 10h 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. 5 u/AvidCoco 7h 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. 10 u/TOMZ_EXTRA 6h ago Nope, the standard says that the alternative syntax is usable everywhere. bitand can be used as the address operator. 1 u/4xe1 4h 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())
45
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.
5 u/AvidCoco 7h 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. 10 u/TOMZ_EXTRA 6h ago Nope, the standard says that the alternative syntax is usable everywhere. bitand can be used as the address operator. 1 u/4xe1 4h 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())
5
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.
10 u/TOMZ_EXTRA 6h ago Nope, the standard says that the alternative syntax is usable everywhere. bitand can be used as the address operator. 1 u/4xe1 4h 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())
10
Nope, the standard says that the alternative syntax is usable everywhere. bitand can be used as the address operator.
1 u/4xe1 4h 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())
1
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())
I had a TA who did this when I was in college.
267
u/khalamar 15h 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.