Earlier quoted context omitted.
> a barely functional string type There's a string type in C? All I see are character arrays and a few (poorly thought out) conventions for using them.
It may be cumbersome, but C has string handling: http://en.wikipedia.org/wiki/C_string_handling
The Unreasonable Effectiveness of C
241–250 of 394 posts
Re: The Unreasonable Effectiveness of C
#242Earlier quoted context omitted.
You can wind up with "an unmaintanable mess riddled with security holes" in any language -- that's not unique to C. Regarding the flaws you have mentioned in C: Its flaws are very very well known, and this is a virtue. All languages and implementations have gotchas and hangups. C is just far more upfront about it. And there are a ton of static and runtime tools to help you deal with the most common and dangerous mist…
Security holes you wind up with in a Java or whatever codebase take the form of logic errors allowing for compromise of user information, or SQL injection or command injection. These are bad, they totally compromise data and systems. Security holes in C applications allow for the injection of low-level programs. This is way more annoying, IMO. also the static and runtime tools for C are good, and getting better, but…
It just there is a lot of C out there which means we will see it for ever in our systems somewhere. It will get better over time as tools improve the existing C code base.
Re: The Unreasonable Effectiveness of C
#243Earlier quoted context omitted.
> It's a tool for some jobs; definitely not all. I'd completely agree. I would not use C for doing any web platform work (writing a REST service as you say). I may write a webserver in C if I had tight memory constraints. Where I see C still being very useful: embedded applications, drivers, and latency sensitive code. When you are trying to push the most I/O possible through a network interface or disk interface, C…
I have done low-level and mobile programming on very restricted platforms and I cannot see any reason why in the world I would use C instead of C++. Basically there is always an opportunity to use C++ if you can use C. Myths that C++ is slower are spread by people who just do not know C++ well or are not skilled/clever enough to use it.
Re: The Unreasonable Effectiveness of C
#244Earlier quoted context omitted.
And can't be _implemented_ in any language. C gives you at least the charming fact that you can implement one without any overhead of objects, classes, implicit memory management or some other concept, just having a lightweight implementation that you may use in an environment without any libraries, like std or else..
So what you're saying is that C lets you write it on your own. In fact, and this might sound crazy, but you can do that exact same thing in C++, it's just that people don't because the C++ standard library provides plenty of performant and featureful data structures for you. Besides, anything the C++ standard template library map does when implementing a red-black tree is exactly what you would need to do if you wrot…
C has libraries too. I personally like the headers used by openbsd: http://www.openbsd.org/cgi-bin/cvsweb/src/sys/sys/tree.h?rev...
Re: The Unreasonable Effectiveness of C
#245Earlier quoted context omitted.
well the thing is, it also works for std::vector , or std::vector , or anything you want. Last time I checked in C you'd have to either duplicate all your array code for each type or resort to something like void*. Only for that I'd use C++ (yes, you can use it without classes if you want).
Last time I checked in C, all pointer types where the same storage size. There's no need to define the same data structure multiple times by using templates. You just use casts.
Now, that said, it is possible to write generic link list routines (I've done it) but the devil is in the details.
Re: The Unreasonable Effectiveness of C
#246Earlier quoted context omitted.
Really?! Have you ever looked at what InteliJ allows as refactoring tools?
IntelliJ Idea for Java?
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.
Re: The Unreasonable Effectiveness of C
#247Earlier quoted context omitted.
That's the IDE not the language. Java, itself, does not highlight your syntax errors. Nor does C. There are IDEs out there that will do exactly the same thing for you for your C code.
The difficulty of writing static analysis software does depend on the language, though. In Visual Studio, for example, intellisense and autocompletion are vastly superior in C# compared to C++. As a matter of interest, which C IDEs are you referring to? I'd like to check them out.
VS2012 has similar capabilities for C++.
Re: The Unreasonable Effectiveness of C
#248Earlier quoted context omitted.
The article argued that C was effective in practice, not that it was better than X in some other sense. Would you prefer to write production code in FORTRAN, ALGOL 60 and 68, Turbo Pascal, or Smalltalk to writing it in C today?
Yes. Though I tend to use PLT Racket these days when the choice of language is not constrained by other factors.
I think the author's criteria for "effectiveness" are very much different from yours, hence the different conclusions.
Re: The Unreasonable Effectiveness of C
#249Earlier quoted context omitted.
The article argued that C was effective in practice, not that it was better than X in some other sense. Would you prefer to write production code in FORTRAN, ALGOL 60 and 68, Turbo Pascal, or Smalltalk to writing it in C today?
Yes. Though I tend to use PLT Racket these days when the choice of language is not constrained by other factors.
Re: The Unreasonable Effectiveness of C
#250To nitpick on a single statement: > C has the fastest development interactivity of any mainstream statically typed language. What? Despite all its shortcomings, Java in a modern IDE effectively has zero build time. The level of interactivity is as fast as that of interpreted languages. I haven't seen anyone manage this with C yet.
I have worked on several projects in Java (using Eclipse as an IDE). In my experience there is a 'significant' latency between when I hit run, and my program starts. (My suspicion is this time is spent starting the JVM, not compiling). Every (non kernel) C project I have worked with has effectively 0 build time after making changes. This is because they all used make which (like Eclipse and likely all IDEs) only reco…
JRebel is also worth investigating if you are getting paid to work with java code.