Re:Rust-GPU: Making Rust a first-class language and ecosyste...
by astro-codes on Saturday October 24, 2020 @03:17AM
(#24877540)
Interesting! Could you explain? What C features doesn't C++ have?
[ Parent
| on HN ]
Re:Rust-GPU: Making Rust a first-class language and ecosyste...
by atq2119 on Saturday October 24, 2020 @04:28AM
(#24877766)
- C has its own syntax for generics
- C has broader support for designated initializers
- C allows implicitly casting void* to any other pointer type
- C has fewer keywords, e.g. you can use "friend" or "class" as identifier
- ...
Despite all this, it's true enough that one can easily write C code that also compiles as C++.
Re:Rust-GPU: Making Rust a first-class language and ecosyste...
by xondono on Saturday October 24, 2020 @04:53AM
(#24877871)
- C has its own syntax for generics
C has generics?
Re:Rust-GPU: Making Rust a first-class language and ecosyste...
by kzrdude on Saturday October 24, 2020 @06:09AM
(#24878163)
Nothing like C++ or Rust generics. C has _Generic (type-switch macro): https://en.cppreference.com/w/c/language/generic
Go into pointer qualifiers and const with _Generic and you'll see that it's a mess to do anything serious with it. But it's handy for type-generic math (tgmath.h style) and that's seems to be about it.