this post was submitted on 18 Oct 2024
0 points (NaN% liked)

Programming Horror

1889 readers
3 users here now

Welcome to Programming Horror!

This is a place to share strange or terrible code you come across.

For more general memes about programming there's also Programmer Humor.

Looking for mods. If youre interested in moderating the community feel free to dm @[email protected]

Rules

Credits

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 0 points 4 weeks ago (5 children)

You don't need to cast the return value from malloc.

[–] [email protected] 0 points 4 weeks ago (1 children)

True. Although given how easy it is to cast void pointers to the wrong damn thing, it would be nice if you did, makes refactoring much easier. Makes me appreciate std::any all the more.

[–] [email protected] 0 points 3 weeks ago* (last edited 3 weeks ago)

Void pointer should be avoided anyways. Even I find them rare and I mostly work in embedded RTOS

load more comments (3 replies)