3 ms·
> Implicit coercion of 2 to a pointer: int *p = 2; Look, you and I know this is horrible and should probably be a war crime, but you have to admit: it's e
by xyzzy_plugh 5y ago
> Implicit coercion of 2 to a pointer:
int *p = 2;
Look, you and I know this is horrible and should probably be a war crime, but you have to admit: it's elegant. The ability to pierce the abstraction with C is the only reason it's on that list. I can teach people how computers actually work without getting to assembly (though it's usually a good idea to go there). It all depends on the goal. If your goal is to understand how computers execute programs, then a little C doesn't hurt.
> But it teaches bad habits, which have to be unlearned.
Apologies, but you're confused again: you've conflated learning how to code, with learning to be a software engineer. They're related, but less so than you think.
In my experience, it is impossible to teach a student a lesson that requires experience without providing them the opportunity to experience it. Teach someone Basic, let them do bad things, then show them the light.
"If you give a man a fish" and all that.
- WalterBright 5y agoTelling me again that I'm confused and telling me what I think and what I have to admit is rather presumptuous. You can make all your points just fine without that. When I see `int *p = 2;`, "elegant" is not at all what comes to mind. "Bug" is what comes to mind. Reminds me of my wood shop teacher. He showed me the right way to use hand tools, from the start, which pays off every time since that I use one. He also showed how to use power tools, and never failed to show us the missing finger on his hand - the price for taking shortcuts. Whenever I use the table saw, I think of his finger stub and slow down, take my time, and do it right.