News for hackers. Stuff that matters.
Re:On Apple's Love Affair with Swift by SlowRobotAhead on Saturday August 11, 2018 @06:28PM (#17741897)
As an embedded engineer I can’t agree that C “has problems” because it treats you like a big boy with your big boy pants on. :)
Re:On Apple's Love Affair with Swift by fisherjeff on Saturday August 11, 2018 @07:46PM (#17742149)
I work almost exclusively in embedded C and even I can’t agree with this. Just for starters, those two statements are not mutually exclusive.
Re:On Apple's Love Affair with Swift by ovao on Saturday August 11, 2018 @06:46PM (#17741953)
Which is a problem for developers who simply want to write code without having to reason about whether it’s safe to dereference something, and without having to worry about a simple oversight resulting in the programmatic equivalent of summoning Cthulhu.
Re:On Apple's Love Affair with Swift by SlowRobotAhead on Sunday August 12, 2018 @02:48AM (#17743266)
>a problem for developers who simply want to write code without having to reason

Still not seeing the problem.

Pointers aren’t magic and aren’t hard.

Re:On Apple's Love Affair with Swift by ovao on Wednesday August 15, 2018 @12:22AM (#17763753)
Pointers, conceptually speaking, are not hard.

Pointers, in practice, are hard. Even C-family compilers cannot safely reason about them in many (most) cases.

Re:On Apple's Love Affair with Swift by pertymcpert on Monday August 13, 2018 @09:21AM (#17749816)
Oh boy, trying to debug some miscompile because of a subtlety in aliasing rules would make me disagree.
Re:On Apple's Love Affair with Swift by pertymcpert on Saturday August 11, 2018 @07:56PM (#17742190)
As a C compiler engineer I can assure you it has problems.
Re:On Apple's Love Affair with Swift by SlowRobotAhead on Sunday August 12, 2018 @05:31PM (#17746515)
Did I say C didn’t have problems? Or did a say it’s not a problem that C might allow you to do unsafe things?
Re:On Apple's Love Affair with Swift by pertymcpert on Monday August 13, 2018 @09:23AM (#17749823)
I think so?

“As an embedded engineer I can’t agree that C “has problems” because it treats you like a big boy with your big boy pants on. :)”

Re:On Apple's Love Affair with Swift by SlowRobotAhead on Monday August 13, 2018 @07:24PM (#17754360)
Do you know what “because” in that sentence means?

Edit: Nah, that’s OK. Just downvote and scamper on. Make HN more like Reddit, that’s what this place needs!

Re:On Apple's Love Affair with Swift by dang on Tuesday August 14, 2018 @03:49AM (#17756191)
Could you please stop posting unsubstantive comments to Hacker News?
Re:On Apple's Love Affair with Swift by pertymcpert on Tuesday August 14, 2018 @06:39AM (#17756725)
Well I took it to mean that because you think it treats you as a "big boy" you don't think it has problems.
Re:On Apple's Love Affair with Swift by pertymcpert on Tuesday August 14, 2018 @06:41AM (#17756730)
Oh and I have no idea how to downvote on HN. Not that I care, but I don't see any downvote buttons.
Re:On Apple's Love Affair with Swift by blub on Sunday August 12, 2018 @04:05AM (#17743455)
There is no such thing as "big boys" in software engineering, there's only humans which have certain cognitive weaknesses.

C is really good at exploiting those, while at the same time giving programmers a feeling of power.

Re:On Apple's Love Affair with Swift by speedplane on Sunday August 12, 2018 @04:08AM (#17743464)
So providing a feeling of power over the language and it's abilities is not a legitimate advantage of the language?

Isn't that why everyone loves python, solving a complex problem in a handful of easily readable lines of code?

Re:On Apple's Love Affair with Swift by blub on Sunday August 12, 2018 @05:34AM (#17743666)
The feeling of power is nice for the programmer, but it doesn't influence the technical capabilities of the language, which are deplorable safety-wise.
Re:On Apple's Love Affair with Swift by SlowRobotAhead on Sunday August 12, 2018 @12:35PM (#17745107)
Did you see the smiley face in my post that’s implied I’m kinda joking.

Also... I’m a little concerned that your post has “we’re all equal” social justice vibe to it... which is silly. C is more powerful than because “safety features” aren’t there.... deplorable... LOL.

You try going a day without using something programmed in C.

Re:On Apple's Love Affair with Swift by blub on Tuesday August 14, 2018 @02:25AM (#17755944)
Oh boy, how I wish I could have at least one day without something programmed in C. I'm so sick of all the vulnerabilities...

No social justice vibe was meant. I was trying to say that we're all bad at dealing with the kind of errors which appear in a typical C or (perhaps to a lesser extent) C++ program.

I know that some people are able to do this more successfully than others because of skill, etc, but it's not just about certain individuals. As a whole, the C community has a really poor track record at security and safety and that has a lot to do with the language itself.

Re:On Apple's Love Affair with Swift by chillacy on Monday August 13, 2018 @02:24AM (#17748352)
Tone is a tough thing to get right, and I'd say your initial post came off pretty condescending to a lot of people, regardless of whether you meant it or not. It's not even a C thing either, I've seen the same thing where someone declares functional programming as the only "serious programming" and category theory is easy, so everyone else is wasting time with imperative languages. So, it's a bit off-putting.
Re:On Apple's Love Affair with Swift by pjmlp on Sunday August 12, 2018 @12:40PM (#17745139)
Every single day back when I was developing software for ZX Spectrum, Amiga and MS-DOS, before UNIX's influence took over the industry and forced us into dealing with C.

Thankfully there was already C++ for those of us that wouldn't move into such a limited language versus what something like Turbo Pascal 6.0 for MS-DOS was already capable of, feature wise.

Re:On Apple's Love Affair with Swift by SlowRobotAhead on Sunday August 12, 2018 @01:08PM (#17745271)
Ok... so if I’m getting the idea here... C is more limited, but also dangerous because it gives direct access to memory and pointers making it dangerous.

Man... to listen to hackernews tell it... no one should use C!

I wonder how many comments describing how bad C is are from people on Linux machines?

Re:On Apple's Love Affair with Swift by pjmlp on Monday August 13, 2018 @02:26AM (#17748364)
The problem is not direct access to memory and pointers as such, every systems programming language needs to provide such features.

The problem with C, versus other systems programming languages it that it its pointers, implicit conversions of array into pointers, integer operations, string and array bounds don't have any kind of validation.

On other systems languages disabling such validations is explicit.

C is like JavaScript in the browser, we have to put up with it because UNIX clones won the market of commodity OSes.

C on its own without UNIX, would have failed in the market.

On the desktop world it was already being replaced by C++, Smalltalk, VB, Delphi and 4GL before FOSS based on UNIX and C started to be widespread.

Unfortunately it is impossible to convince people on pure UNIX based OSes to use something else.

Fortunately, Apple, Microsoft, Google, Sony, Nintendo are able to set which programming languages one is allowed to use on their platforms and C is on the way out on their SDKs.

Re:On Apple's Love Affair with Swift by SlowRobotAhead on Tuesday August 14, 2018 @02:43AM (#17755997)
LOL yea, C is going away alright. Just as soon as every company you mentioned and everyone else in the world stops making embedded electronics!