Live data from Hacker News

The Unreasonable Effectiveness of C

damienkatz.net

301–310 of 394 posts

Re: The Unreasonable Effectiveness of C

#301
post #180

Earlier quoted context omitted.

Maybe because he uses C and have never heard someone refering to VM and C in same sentence. I'm also interested in this because i also don't get wtf is "C VM". He could be refering to layer below which includes hardware and OS combo. You know, memory pages, translations, ... Is he talking about that? :-)

He´s using the term VM, as a machine abstraction, wich C really is, in the same perspective the OS is a VM.. it will abstract you away, from device drivers, processor assembly, memory, (using files to represent a collection of data blocks in a block device) C is a VM. but not the same way the Java VM is a vm.. cause that is a VM on top of another VM (OS and processor assembly) its a software abstraction of a hardware…

Software abstracion of a hw system sounds ok. VM in C context is little bit weird ... but it's only terminology

Re: The Unreasonable Effectiveness of C

#302

My humble opinion: Scripting languages like python do have merits. As a 20+ years C++ programmer, I sadly found there seems no scenarios that C++ can play very well. Compared to C, C++ projects are much harder to maintain. Whenever C++ should be used, C is always a better option.

Well, I think people forget history a bit sometimes. For 20 years or so the most common exploit in any system was a buffer overflow, often in string manipulation. I think we're finally getting past that, but C's lack of abstraction over string pointers was a major, major problem and even today if I was writing a secure system I would choose C++ if only to use the std::string class.

Re: The Unreasonable Effectiveness of C

#303
"With C++ you still have to know everything you knew in C, plus a bunch of other ridiculous shit."

So true. C++ is designed by someone who is a moderately smart but not a great engineer. There are too many details without much benefit, and you are encouraged to hide things in obfuscated manners, rather than doing straightforward programming.

Re: The Unreasonable Effectiveness of C

#304
post #246

Earlier quoted context omitted.

IntelliJ Idea for Java?

Yes. There are lots of refactorings that cannot be done by simple search and replace, even for C, because they require semantic knowledge of the language.

There is a problem that each and every tool for semantic-aware C/C++ refactoring I have tried does not work 100% of the time (i.e. it sucks more than 0%). This happens particularly because C/C++ have header files that expand to huge source files and preprocessor macros driving the parsers nuts because the parsers of the refactoring tools are simplified for speed, and also in a typical C/C++ program there is a number of combinations of macros that can be active or non-active depending on compiler options. So in case of C it always comes out faster, easier and more reliable for me to use basic tools such as search/replace because C has very simple semantics without namespaces. I often do that even in C++ because of the mentioned reasons.

Re: The Unreasonable Effectiveness of C

#305
post #142

If you tried to use an F1 racecar as your day to day commuter, of course you would complain about it. It would be horrible. Tune the engine every day!? Tire grip changes over TIME? Must watch oil temps so carefully? What a pain in the ass. Also easy to crash. If you tried to use your soccer-mom minivan to participate in F1 races, of course you would complain. I can't tune the engine? I can't tinker with the oil press…

I really like your analogy.

Re: The Unreasonable Effectiveness of C

#307

My humble opinion: Scripting languages like python do have merits. As a 20+ years C++ programmer, I sadly found there seems no scenarios that C++ can play very well. Compared to C, C++ projects are much harder to maintain. Whenever C++ should be used, C is always a better option.

I believe it depends much more on how the code is written, rather than on C vs C++. Believe me, I am able to write as obfuscated and impossible to maintain code in C as in C++ :) (Hopefully) my code in C++ is easy to maintain because of clear concise architecture, simple interfaces, good naming and the use of complicated things such as template metaprogramming only where it is necessary. I would prefer to maintain a C++ codebase written with a concise architecture and the KISS principle in mind than a C codebase written by unqualified programmers without the clear understanding of the task. Also, if you have have 20+ years of experience, then you have started long before C++ became a stable, developed and seasoned tool. I think the finally good enough state of C++ across the platforms was achieved at least in mid 2000s, although it is still in process with the new standard. Early C++ code was a mess (even Boost still contains tons of ugly workarounds for the early compilers).

Re: The Unreasonable Effectiveness of C

#308
post #302

My humble opinion: Scripting languages like python do have merits. As a 20+ years C++ programmer, I sadly found there seems no scenarios that C++ can play very well. Compared to C, C++ projects are much harder to maintain. Whenever C++ should be used, C is always a better option.

Well, I think people forget history a bit sometimes. For 20 years or so the most common exploit in any system was a buffer overflow, often in string manipulation. I think we're finally getting past that, but C's lack of abstraction over string pointers was a major, major problem and even today if I was writing a secure system I would choose C++ if only to use the std::string class.

This is not exactly the C language problem, but the design flaw of the C standard library. Also, there are folks out there that still use unprotected buffers in C++ instead of safe types.

Re: The Unreasonable Effectiveness of C

#309

Earlier quoted context omitted.

C is weakly-typed. You can cast anything to anything else and the compiler won't stop you.

That's right! Completely forgot about the cast.

The worse thing is that you can address a memory location and interpret it as another type (aliasing).

Re: The Unreasonable Effectiveness of C

#310

Earlier quoted context omitted.

Here's the thing: "high-level", when applied to a programming language, has a historical context. It means something specific (see: http://en.wikipedia.org/wiki/High-level_programming_language ), and what it means and has always meant is that the language in question abstracts away registers and allows structured programming (as in, through the use of if, while, switch, for, as opposed to using labels and branching).…

Here's the thing: The English language is polysemous. Computer science jargon even more so. Meaning that any particular term can often have many gradations of meaning. So "X means Y" does not necessarily imply "X does not mean Z". Especially when Y and Z are similar concepts. I suppose we could lament the inherent ambiguity of the jargon, but the truth is that for the most part problems only result when ambiguous lan…

> polysemous

I did not know this word. Thank you.

Post reply on HN