Live data from Hacker News

Ask HN: What would you tweak in C to make it a nicer language?

news.ycombinator.com

1–10 of 13 posts

Ask HN: What would you tweak in C to make it a nicer language?

#1
If you could tweak C without adding huge new features (like OO or changing paradigm), what would your changes be?

examples: Zero initialized memory. Improved function pointer syntax. Remove '->' and replace with '.'. Array bounds checking. Standard inline assembly syntax. etc. etc. (There are probably a lot I haven't thought about)

Re: Ask HN: What would you tweak in C to make it a nicer language?

#4

Probably a legit macro system.

Any ideas on how it should look? Perhaps there are good examples in non lisp languages which have good systems, though i haven't tried them to know which is good.

I don't have much experience with it but Rust's seems to be pretty good.

Re: Ask HN: What would you tweak in C to make it a nicer language?

#7
Some handy little things:

1. Standard library support for safe arithmetic (easily capturing overflows, underflows, and so forth).

2. Standard library support for threading and synchronization primitives.

3. Mandated tail-call optimization through pragmas or perhaps just requiring it in the spec.

4. Create explicit and differentiated arithmetic and logical shift left and shift right.

5. Add a standard way of specifying arbitrarily-sized integers (with optimization for the common word sizes).

6. Add destructuring operations.

7. Add anonymous unions.

8. Add switching on strings in switch statements.

9. Add proper UTF8 support.

10. Add a slab allocator to the standard library.

11. Add regexes to the standard library (possible as a language feature).

~

Several of these (7, for example) are being addressed in C11 (if that ever comes out).

Re: Ask HN: What would you tweak in C to make it a nicer language?

#9

Some handy little things: 1. Standard library support for safe arithmetic (easily capturing overflows, underflows, and so forth). 2. Standard library support for threading and synchronization primitives. 3. Mandated tail-call optimization through pragmas or perhaps just requiring it in the spec. 4. Create explicit and differentiated arithmetic and logical shift left and shift right. 5. Add a standard way of specifyin…

These are all great.
Post reply on HN