News for hackers. Stuff that matters.
Re:Systemd is bad parsing by xtrapolate on Saturday October 27, 2018 @10:19AM (#18315774)
> "The other thing that you shouldn't do, even though C/C++ allows it, is pointer arithmetic. Again, it's one of those epiphany things C programmers remember from their early days. It's something they just couldn't grasp until one day they did, and then they fell in love with it. Except it's bad. The reason you struggled to grok it is because it's stupid and you shouldn't be using it. No other language has it, because it's bad."

Honestly, this is a pointless rant. "Do this, but don't do that (because that's stupid)".

> "No other language has it, because it's bad"

The reason you "don't have pointer arithmetic in other languages" is - it's been abstracted away from you, for your convenience, so that you can just concentrate on your business logic and not have to worry about the rest. You may not deal with pointer arithmetic, but the people developing your JVM/CPython/V8/Chakra sure do. Author is simply ranting about the possibility of abusing/misusing the mechanisms offered by C/C++.

Re:Systemd is bad parsing by zwkrt on Saturday October 27, 2018 @10:39AM (#18315858)
Programming as a profession is strange because we each do such different things but all tools are available to us all the time. Imagine if this were true in the physical world; you would read arcticles written by accountants like "Dynamite Considered Harmful" with rebuttals titled "Why Dynamite Matters" by construction engineers...
Re:Systemd is bad parsing by taneq on Saturday October 27, 2018 @12:07PM (#18316333)
You see this all the time here on HN. "Interpreted languages are useless" coming from the systems and embedded people. "You can't call yourself a developer if you're not an expert in [FOTM web framework]" from the web devs. "Mutability is evil and reassigning variables is a sign of incompetence" from the functional programming sect.
Re:Systemd is bad parsing by xtrapolate on Saturday October 27, 2018 @11:09AM (#18316032)
It's almost as if things aren't really black or white, there's usually plenty of grey in-between. Things like use-cases, scenarios, trade-offs, intricacies. I find it awkward that a security shop would publish an article using that language - I would personally be embarrassed.
Re:Systemd is bad parsing by jolmg on Saturday October 27, 2018 @11:51AM (#18316254)
> I would personally be embarrassed

The rest of the comment is good, it adds to the argument, and I even agree with it, but there is no reason for this to be here. It doesn't add anything; it's just like calling names. From the HN guidelines:

> Don't be snarky.

> When disagreeing, please reply to the argument instead of calling names. "That is idiotic; 1 + 1 is 2, not 3" can be shortened to "1 + 1 is 2, not 3."

EDIT: To be downvoted like so for reminding people of the guidelines, HN sure is changing. I guess no good thing lasts forever.

Re:Systemd is bad parsing by zzzeek on Saturday October 27, 2018 @11:02AM (#18315992)
this is the most genius thing I've ever read on hacker news.
Re:Systemd is bad parsing by sam0x17 on Saturday October 27, 2018 @10:57AM (#18315966)
This is fantastically imaginative. I love it.
Re:Systemd is bad parsing by thwd on Saturday October 27, 2018 @10:55AM (#18315953)
Pointer arithmetic is abstracted away for _safety_, not convenience. You can read about in e.g. Go's FAQ.

https://stackoverflow.com/questions/32700999/pointer-arithme...

Re:Systemd is bad parsing by mikeash on Saturday October 27, 2018 @01:53PM (#18316854)
Pointer arithmetic can be perfectly safe. C doesn’t implement it safely but that doesn’t mean other languages couldn’t.
Re:Systemd is bad parsing by mixmastamyk on Saturday October 27, 2018 @01:22PM (#18316715)
Or perhaps safety and convenience.
Re:Systemd is bad parsing by ben0x539 on Saturday October 27, 2018 @11:17AM (#18316082)
Do you just take issue with the specific claim that no language should have pointer arithmetic, or do you disagree with the more general thrust of the post?

Sure, it's ranty and, like, maybe closer to op-ed than computer science publication, but I think even among the rarefied breed of people developing your JVM/CPython/V8/Chakra, you could easily find approval for the notion that pointer arithmetic is bad(*) and should be avoided as much as possible.

Re:Systemd is bad parsing by vmchale on Saturday October 27, 2018 @11:04AM (#18316003)
Funnily enough, ATS has pointer arithmetic and it can be safe if you declare the appropriate types.

It seems kind of nuts to say array indexing isn't just a fancier version of pointer arithmetic.

Re:Systemd is bad parsing by thwd on Saturday October 27, 2018 @11:16AM (#18316076)
Array-indexing in C and C++ _is_ pointer arithmetic! It's syntactic sugar. Array-indexing in safe languages is bound checked iff the compiler can't prove the index value to always be in-bounds.
Re:Systemd is bad parsing by mikeash on Saturday October 27, 2018 @01:55PM (#18316860)
In case anyone doesn’t already know, this isn’t a figure of speech. array[5] literally translates to *(array + 5) in C. Since + is a symmetric operator, that means 5[array] is a valid, equivalent expression.
Re:Systemd is bad parsing by zzzcpan on Saturday October 27, 2018 @11:12AM (#18316051)
Array indexing is __bounds checked__ pointer arithmetic.

But not in C.

Re:Systemd is bad parsing by xtrapolate on Saturday October 27, 2018 @11:09AM (#18316036)
> It seems kind of nuts to say array indexing isn't just a fancier version of pointer arithmetic.

I agree.

Re:Systemd is bad parsing by gaius on Saturday October 27, 2018 @01:10PM (#18316654)
Additionally, I don’t think it’s reasonable to extrapolate from the mess that is systemd to all C/C++ code. Some fantastically reliable systems have been developed with them.