Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This 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.



Depends on the functions used. memcpy is better than strcpy


I’m sure you meant something more along the lines of “strncpy is better than strcpy”.


Nah, strncpy is pretty bad and doesn't do something anyone really expects to want.

(strncpy doesn't 0-terminate when it hit max length, nor stop when it sees its first 0 in the source buffer; it acts almost entirely like memcpy except that it writes zeroes to the full length of the destination upon seeing a zero in the source. This is allegedly useful for populating fixed-sized buffers in historical Unix, and can plausibly be useful for writing out tar headers, but in practice very little code in the wild does anything observably different if you #define strncpy memcpy.)


memcpy is better than strncpy and strcpy ;)


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


The only way to real achieve progress in systems programming is through generation change, one person at a time, the problem isn't technical.


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.


Now Object Pascal and Modula-2 are scripting languages....


Well no, and if we're being pedantic I didn't imply that.


> ...concatenating them with a plus sign, like you do in scripting languages.


You got the implication the wrong way around.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: