Liste des Groupes | Revenir à l c |
On 2025-04-22, bart <bc@freeuk.com> wrote:
I don't actually write much raw C. When I generate C, especially if I want someone else to compile the code, then it needs to be conservative.C23 is nothing particularly interesting. A few features I wont't be ableThus if C got, today, the loop features you advocate for, you wouldn't
to rely on until I'm dead.
use them; they would necessarily be after C23.
The time to lobby for them was 30-40 years ago, and in the right way.I'm pretty sure I started complaining here 20 years ago! Perhaps more.
Most of my replies haven't been about the feature itself: it's about people's attitudes to it, defending appalling coding styles, pretending the primitive C feature is superior to anything else, and generally refuting every point I try to make.But that's exactly what some for loop from A to B would be, though.You've also expressed oppositions to extending C, because>
development of C makes it a moving target for your projects.
As I said, development of is not that interesting. Basically sticking
plaster fixes.
No; it just has to be defined at the top of a file which needs it.Either it's in the language or it isn't. It is unacceptable to me to require headers for fundamental language features.
All of a sudden, something has to be in a document you can't beDo you think I haven't played around with such macros? Here's some from 2014:
bothered to read in order to be useful?
Your own stuff is not standardized; presumably you worked onIt is standardised in that no basic language feature, no standard library function, needs some declaration to be used. Example:
it because you find it useful.
Just C syntax does that by itself! My editor uses Ctrl-PageUp/Down to step between functions. But it doesn't work for C source code: you need half a C compiler to figure out where each function starts.I think C's macros are the main thing that have hindered its development.C macros definitely hinder all kinds of tooling.
After nearly 50 years of using alternative languages? Probably not. By the time it became standard, I'd be dead.Result: most people still end up writingThis leads to a bug when myarray is actually a pointer.
sizeof(myarray)/sizeof(myarray[0]).
GCC has a warning for sizeof ptr / sizeof ptr[0] specifically
to catch bugs in this idiom.
It's pretty gross. To my understanding there is some initiative
to get some array length operator.
Of course, you will never use it.
Well, exactly. So how come we ended up with C as the world's primary systems language? Why hasn't C long acquired such useful core features?In the meantime, I'm been able toNot only you, but countless term projects in undergraduate compiler
write myarray.len for 43 years, and also:
>
print a, b # who cares about format codes
>
As for MIN/MAX, I routinely use:
>
max(a, b)
max(x, y) # overloaded per type
a max:=b # augmented assignment
a.max # maximum value of a's type
T.max # maximum value of type T
>
Oh, and I already have Unless:
>
unless a then b end
return 0 unless cond
class. So what?
Les messages affichés proviennent d'usenet.