I guess speed is the strength of C.
Am I right?
I guess speed is the strength of C.
Am I right?
[ Never code before desk work ]
-------------------------------------:-->
A man who fears Nothing is the man who Loves Nothing
If you Love Nothing, what joy is there in your life.
=------------------------------------------------------= - I may be wrong.
Another weakness of C (or is it a weakness of the programmer?) is that C doesn't perform bound checking. It's easy to overwrite the end of a string and actually overwrite other variables. Hackers can use this weakness...
Ohh.. I don't think it's a weakness of C. Programmers know this. It's because of so open and so free language.
Programmers know this (weakness of C) but they are also very lazy. If they want to read a persons name they allocate a buffer of 100 bytes long (should be enough) and read the name from input with the gets function. This is just a simple (stupid) example but I have seen it many times. An the most common mistake: people using the strcpy function without checking if the target array is large enough.Originally posted by zahid
Ohh.. I don't think it's a weakness of C. Programmers know this. It's because of so open and so free language.
I wouldn't call that a weakness, that's just something that comes when people get access to any type of pointer as well. Besides, I'd rather do my own bounds checking than use internal bounds checking. Everytime you access an array you don't have to explicitly or implicitly check to see if it's within bounds -- often times you already know.Originally posted by Monster
Another weakness of C (or is it a weakness of the programmer?) is that C doesn't perform bound checking. It's easy to overwrite the end of a string and actually overwrite other variables. Hackers can use this weakness...
That's a weakness of people using C, not of the language itself.Originally posted by Monster
Programmers know this (weakness of C) but they are also very lazy. If they want to read a persons name they allocate a buffer of 100 bytes long (should be enough) and read the name from input with the gets function. This is just a simple (stupid) example but I have seen it many times. An the most common mistake: people using the strcpy function without checking if the target array is large enough.
If there are so many people (also professional) that make this kind of mistakes, than I don't call it a weakness of the programmer but a weakness of the progrogramming language.Originally posted by Polymorphic OOP
That's a weakness of people using C, not of the language itself.
> If there are so many people (also professional) that make this kind of mistakes, than I don't call it a weakness
>of the programmer but a weakness of the progrogramming language.
Or rather, a weakness of the books and teachers who told them that an old function which is unsafe and should have been removed from the standard libraries long ago is the best solution.
-Prelude
My best code is written with the delete key.
Also C++ doesn't, unless you add functionality to your classes which takes care of it.Another weakness of C (or is it a weakness of the programmer?) is that C doesn't perform bound checking.
A nice point of view, which I at first agreed with. If most people using a system and all make the same mistake in using the system, then this can be seen as a defect in the design of the system. If the design was better, people could immediately see that the system can't be used like they did or the system could even prevent people from misusing it.If there are so many people (also professional) that make this kind of mistakes, than I don't call it a weakness of the programmer but a weakness of the progrogramming language.
But, in C++ classes, bound checking can be built in. In C also such could be built in libraries using datastructures. Note that these kind of checks are all higher level operations, both C and C++ allow such higher level operations, but also low level operations.
So this aspect of C and C++ is a consequence of the low level character of the languages. Programmers using C or C++ must know this, if they still make the error, it can be seen as a weakness of the programmers.
Or just lazy programmers... (but than again that's also a weakness)Originally posted by Prelude
> If there are so many people (also professional) that make this kind of mistakes, than I don't call it a weakness
>of the programmer but a weakness of the progrogramming language.
Or rather, a weakness of the books and teachers who told them that an old function which is unsafe and should have been removed from the standard libraries long ago is the best solution.
-Prelude
I'm not only talking about using wrong functions but also using functions the wrong way like strcpy, memcpy, etc.
A logical error on the part of the programmer can not be considered a fault of the language being used. Attempting to access data beyond the bounds of an array can happen in just about any language -- the fact that other languages do internal error checking doesn't change the fact that there would be a problem with the program anyway! Trying to access an index beyond the bounds of an array is a logical error that exists whether or not the language checks for it. If you are really that poor a programmer that you need the computer to check for you, then make a function that checks bounds which takes a parameter for the array index, but that won't fix any problems, it only masks them, just like in other languages. C and C++ give you more control, which is not a weakness. If the programmer using the language can't deal with it, that's their problem, not the language's.
How is that a weakness of the language. If a person uses a function that they don't understand how to use, then that's their problem.I'm not only talking about using wrong functions but also using functions the wrong way like strcpy, memcpy, etc.
If you don't need more control but still have to write (potentially bug ridden) extra code because of the control available, then it's a weakness.C and C++ give you more control, which is not a weakness
Joe
It's a weakness of c and a strength of c.That's a weakness of people using C, not of the language itself.
An out of range array access can result in code that
appears to run correctly but at a critical point
will fail or effect other parts of the program. Some other
languages will throw an exception.
> A logical error on the part of the programmer can not be considered a fault of the language being used.
I'm not saying it's a fault of the language, just a weakness...
> Attempting to access data beyond the bounds of an array can happen in just about any language -- the fact that other languages do internal error checking doesn't change the fact that there would be a problem with the program anyway! Trying to access an index beyond the bounds of an array is a logical error that exists whether or not the language checks for it.
There is a big difference between doing internal checking or not. Like I said in my first post without internal bound checking you can overwrite other variables. It's relatively easy to hack these programs.
> How is that a weakness of the language. If a person uses a function that they don't understand how to use, then that's their problem.
Okay, maybe I didn't explain this right. The function is used in a "correct" way but without bound checking of the programmer itself.
> If you don't need more control but still have to write (potentially bug ridden) extra code because of the control available, then it's a weakness.
That sounds more like a poor choice of language for the task.
>The function is used in a "correct" way but without bound checking of the programmer itself.
So you're saying that C should baby the programmers like Pascal? One of the reasons you can do so much with C is because the language assumes you're not a moron. If in fact you are a moron, you shouldn't be using C.
-Prelude
My best code is written with the delete key.