Giving C a superpower: custom header file (safe_c.h)
hwisnu.bearblog.dev
Giving C a superpower: custom header file (safe_c.h)
1–10 of 277 posts
Re: Giving C a superpower: custom header file (safe_c.h)
#2This is cute, but also I'm baffled as to why you would want to use macros to emulate c++. Nothing is stopping you from writing c-like c++ if that's what you like style wise.
Re: Giving C a superpower: custom header file (safe_c.h)
#3Given how simple examples in this blog post are, I ask myself, why don't we already have something like that as a part of the standard instead of a bunch of one-off personal, bug-ridden implementations?
Re: Giving C a superpower: custom header file (safe_c.h)
#4Re: Giving C a superpower: custom header file (safe_c.h)
#5Just don't use C for sending astronauts in space. Simple.
C wasn't designed to be safe, it was designed so you don't have to write in assembly.
Just a quick look through this and it just shows one thing: someone else's walled garden of hell.
Re: Giving C a superpower: custom header file (safe_c.h)
#6I don't understand this passion for turning C into what it's not... Just don't use C for sending astronauts in space. Simple. C wasn't designed to be safe, it was designed so you don't have to write in assembly. Just a quick look through this and it just shows one thing: someone else's walled garden of hell.
But do use C to control nuclear reactors https://list.cea.fr/en/page/frama-c/
It's a lot easier to catch errors of omission in C than it is to catch unintended implicit behavior in C++.
Re: Giving C a superpower: custom header file (safe_c.h)
#7Nice toy. It works until it stops working. An experienced C developer would quickly find a bunch of corner cases where this just doesn't work. Given how simple examples in this blog post are, I ask myself, why don't we already have something like that as a part of the standard instead of a bunch of one-off personal, bug-ridden implementations?
If you need to cleanup stuff on early return paths, use goto.. Its nothing wrong with it, jump to end when you do all the cleanup and return. Temporary buffers? if they arent big, dont be afraid to use static char buf[64]; No need to waste time for malloc() and free. They are big? preallocate early and reallocate or work on chunk sizes. Simple and effective.
Re: Giving C a superpower: custom header file (safe_c.h)
#8Re: Giving C a superpower: custom header file (safe_c.h)
#9Re: Giving C a superpower: custom header file (safe_c.h)
#10C++: "look at what others must do to mimic a fraction of my power" This is cute, but also I'm baffled as to why you would want to use macros to emulate c++. Nothing is stopping you from writing c-like c++ if that's what you like style wise.
It's choosing which features are allowed in.