this post was submitted on 11 Feb 2025
238 points (95.4% liked)

Programmer Humor

33315 readers
848 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 13 comments
sorted by: hot top controversial new old
[–] HStone32@lemmy.world 2 points 1 hour ago

Safe code is a skill, not a feature.

[–] affiliate@lemmy.world 1 points 2 hours ago (1 children)

i will never forgive C for making the type syntax be

char* args[]

instead of the much more reasonable

&[char] args 

it also bothers me that char* args[] and char c are “the same type” in the sense that the compiler lets you write

char c, *args[5];

with no problems. i think the C languages would be way easier to learn if they had better type syntax. don’t even get me started on C++ adding support for

auto fn_name() -> ReturnType { … }
[–] barubary@infosec.exchange 1 points 56 minutes ago (1 children)

@affiliate Hey, you didn't even mention that char *args[] actually means char **args in a parameter list.

[–] affiliate@lemmy.world 1 points 30 minutes ago

god, what a beautiful language. it brings a tear to my eye

[–] barubary@infosec.exchange 48 points 14 hours ago

Strictly speaking, it should be

Unsafe block syntax in C++

{  ...}
[–] lily33@lemm.ee 31 points 14 hours ago* (last edited 14 hours ago) (1 children)

That is why I use just int main(){...} without arguments instead.

[–] Bogus5553@lemm.ee 21 points 13 hours ago* (last edited 13 hours ago) (3 children)

Any void main(){...} enjoyers?

[–] CausticFlames@sopuli.xyz 1 points 2 hours ago

int main(void) { . . . } for me!

[–] stebo02@lemmy.dbzer0.com 4 points 6 hours ago (2 children)

besides not requiring a return value, what difference does it make?

[–] Buddahriffic@lemmy.world 2 points 6 hours ago

It will also give an error if you try to add a return value anyways.

[–] barubary@infosec.exchange 2 points 6 hours ago (1 children)

@stebo02 @Bogus5553 Neither of them require a return value, but void main isn't legal C++.

[–] stebo02@lemmy.dbzer0.com 1 points 5 hours ago

yeah I thought so, does it work in C?

[–] Thorry84@feddit.nl 2 points 10 hours ago

while (true) {...}