Earlier quoted context omitted.
Not to mention that both C++ and Rust can specialise algorithms and containers for specific types, whereas in C most developers resort to void* and function pointers. It's not unusual to see C programs written in a "typical" C style become dramatically faster when rewritten in a more modern language. For example, typical C programs also don't use hashtables even when this makes the most sense, causing weird performan…
"void* and function pointers" behaves essentially the same as templates, assuming the compiler inlines or function clones the function called with constant expression arguments.
The case against a C alternative
251–260 of 388 posts
Re: The case against a C alternative
#252Finally an article I can agree with. C is great mostly because it's easy to learn, and it has many other advantages. I dislike all those new languages because they have too many features, and they're non trivial to learn. I've looked at some rust codebases and I don't think there will be a lot of people who will want to maintain them. Rust is difficult, even though it's an awesome language. A language that could comp…
Go?
Re: The case against a C alternative
#253> any safety checks put into the competing language will have a runtime cost, which often is unacceptable. Suppose you have bounds checks on array accesses, but your program is 100% correct and the panic case is never hit. Doesn't the branch predictor essentially make the bounds check free? Or very low cost at least?
That said, a lot of pedestrian code that isn't running particularly hot would probably be better off including runtime checks by default.
Re: The case against a C alternative
#254This article is just apologism for the status quo. Nothing new here. > Memory allocation, array and string handling are often tricky, but with the right libraries and a sound memory strategy, it can be minimized. Such a handwavy deflection. Parsing strings in C is a joke and also a minefield bursting with vulnerabilities. And if you use null terminated strings (which you are, let’s face it) it’s slow.
Typical statement coming from people lacking experience in this field (no offense meant). The truth is, parsing strings in C is as easy as in any other language. You have a string array and a length field, and you scrub through it from left to right with a cursor. Done. What you do not get in C is creating lots of string objects willy-nilly, and concatenating them with a plus sign, like you do in scripting languages.
Re: The case against a C alternative
#255Earlier quoted context omitted.
Precisely. This is perhaps the strangest part of the original post: C++ has the same performance advantages as Rust! It has them not because it's more safe (although it is, in some regards), but because it allows programmers to express behaviors that the compiler can reason about statically.
Interesting. Can you list an example of C++ type system allowing optimization Rust system doesn't?
[0] https://capnproto.org/news/2015-03-02-security-advisory-and-...
Re: The case against a C alternative
#256Earlier quoted context omitted.
That's a weird analogy considering humans used base-12 (and base-20 and base-60) number systems for most of history.
Really? Wikipedia says it is historically uncommon EDIT: What language uses base-60??
Re: The case against a C alternative
#257Earlier quoted context omitted.
Ok, but there exists a sulotion for this. Using C++ with STL. Why we exactly need a new language?
There is A solution. Is it the best solution? Are there other solutions which may offer better performance or safety. I don't we should stop trying to improve just because an existing solution exists, especially in the space of systems programming which has barely moved in decades
Re: The case against a C alternative
#258I still occasionally write C (and C++), but have come to appreciate the sparseness of Go (although not the intricate abstractions of Rust) and keep wondering if Zig (which does cross-compilation almost as effortlessly as Go) shouldn’t be more popular. In the end, though, you can accomplish the same (from an outcome perspective, not necessarily from a satisfactory one) in all of them, so I try not to be overly biased,…
I’d like to use Zig a bit more, but the standard library is still going through some significant changes (it seems) which makes it slightly harder to commit to at the moment.
In general I wonder if some of these languages would actually benefit from Jai’s approach of deferring availability until the language is ready. While getting early adopters is great for getting feedback early, it can also disuade potential users that try the language before its ready and decide to leave it alone as a result.
Re: The case against a C alternative
#259> First of all, pretty much all languages ever will make vacuous claims of "higher programmer productivity". The problem is that for a business this usually doesn't matter. Why? Because the actual programming is not the main time sink. In a business, what takes time is to actually figure out what the task really is. So something like a 10% or 20% "productivity boost" won't even register. A 100% increase in productivi…
Re: The case against a C alternative
#260Earlier quoted context omitted.
Do you happen to know if is also true for the C replacement languages mentioned in the article: C3, Zig, Odin, Jai and eC?
C3: Currently being looked into https://github.com/c3lang/c3c#current-status Zig: https://ziglang.org/documentation/master/#Assembly Odin: Looks like it's a dead language, but it was on the docket. https://github.com/odin-lang/Odin/blob/master/misc/roadmap.m... Jai: https://github.com/Jai-Community/Jai-Community-Library/wiki/... eC: No clue. Not a great name for googling.