#cstandard

2024-12-15

It turns out that sometime ago #gcc has added the #clang attribute #may_alias to C (and C++). After breaking C semantics, despite clear objections from Dennis Ritchie, to enable unquantified and feeble "optimizations" based on aliasing, the compiler bosses have had to smuggle back a version. Looks like these changes went into some of libc about a year ago.
#wg14 #Cstandard

🤘 The Metal Dog 🤘TheMetalDog
2024-04-26
2023-12-28

One feature C has needed forever is a solution to replace va_args, which is a super ugly hack that is hard to optimize around. Dennis Ritchie asked for one, but it's not the kind of tinkering that earns points in WG14.

Another, much simpler, feature would be to actually define "asm" which is ubiquitous in C code, but according the current standard means nothing. Even if you defined most of it as implementation dependent, that would be an improvement and would allow for more reliable optimization.

#C #Clang #Cstandard #Cfeature

2023-12-19

If we are going to add features to C, they should be useful. Here are four simple ones
1. reverse void *
T x = ....

f( (void *)&x);
....

f(void * y){
T *z= (reverse-void*) y;
...

Where the compiler can complain it can't reverse the cast if the caller code is too obscure.

2. sequence-point;
No code in the text prior to the point can be moved past it.

3. strict typedef
strict_typedef unsigned int centimeters
strict typedef unsigned int inches

inches x; centimeters y;
...

get a compile error on x=y or
x>y etc.

ok: u i=x; y = 5* (i >>1) + (i&1);

4. Option opt-in
gives a standardized in text equivalent of certain compile flags

#c #clang #Cstandard

2023-04-07

Lock Your Thread: A major revision of the C language standard is due out this year fosslife.org/c23-standard-comi #C23 #CStandard #languages #SoftwareDevelopment

fractal made of binary code

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst