actually there are some things in c/c++ that make it more insecure than assembly when you think of it even assembly (intel) has bounds checking instruction and c/c++ just do not seem to care enough undefined
actually there are some things in c/c++ that make it more insecure than assembly when you think of it even assembly (intel) has bounds checking instruction and c/c++ just do not seem to care enough undefined
C++ offers flexibility. If you want bound checking, use vector. It has defined bound-checking behaviour.
That is comparing apples to oranges. Besides, really? I have never come across it when I learned my assembly (but I only learned the basics, that may be why).more insecure than assembly when you think of it even assembly (intel) has bounds checking instruction
Of course C++ has them. "<" and ">".
about < > operators they depend on the knowledge level of user if the user of language is aware of memory bounds being exceeded etc but c/c++ like hll are supposed to provide a safer environment and beside while doing assembly you are cautious before you take every step so having a bounds checking instruction is a plus and not a comparison of apples and oranges beside i agree with STL stuff vectors etc except one thing that is it is still undefined for a vector:
Code:vector<int> myvec(10, 0); myvec[12*1024] = 0xwhocareswhat; // undefined
bound checking is guaranteed if you use .at() to access the vector. If C++ has all these things guaranteed, it would just be another Java (too restrictive for some). For people who know what they are doing, they like choices (eg, using operator[] or .at() to access a vector, depending on whether they want bound checking)
And people write C++ code while they are drunk?... That would be undefined by the standard =).while doing assembly you are cautious before you take every step
There are low-level stuff written in C++, eg, device drivers or programs to be run on embedded devices, and bound-checking is not free (it has a performance penalty that may not be acceptable on certain conditions).
i wonder how much penalty it will make if [] has bounds checking it should not be more than the over head of calling a [] function for non standard data types and for int float just use a plain array if you are really writing realtime application besides no matter how efficient the [] has been made while disregarding bounds it will never be used in a pace maker application they will have their own real time critical solutions
they are just relaxedAnd people write C++ code while they are drunk?... That would be undefined by the standard =).
cheapest mobiles (cell phones) can run java based applications today we have so much processing powers just that c++ has different philosophy undefinedThere are low-level stuff written in C++, eg, device drivers or programs to be run on embedded devices, and bound-checking is not free (it has a performance penalty that may not be acceptable on certain conditions).
True, they have different philosophies. Java thinks it knows better than the programmer (hence forced bound-checking and forced garbage collection and such), whereas C++ gives programmers choices (optional bound-checking via vector, and optional garbage collection using third party libraries). Therefore, I think Java is a better educational language (where people don't know what they are doing), and C++ is a better practical language (where people know what they are doing).cheapest mobiles (cell phones) can run java based applications today we have so much processing powers just that c++ has different philosophy undefined
The overhead of vector's [] is exactly zero. The overhead of bounds checking is huge.i wonder how much penalty it will make if [] has bounds checking it should not be more than the over head of calling a [] function for non standard data types
And please use some punctuation and capital letters. Your posts are borderline unreadable.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
Unreadable... >_<
So much processing power? I think I would love to disagree.cheapest mobiles (cell phones) can run java based applications today we have so much processing powers just that c++ has different philosophy undefined
How many devices today aren't slow? How much time does it take for your phone to start? How long does it take to start an application?
How about other devices - such as your DVD, your DVD recorder, etc, etc? They are all SLOW. And gee, I do wonder why.
Perhaps there isn't as much processing power as we through there was.
I do so agree
Sorry i do not know where to put comma and where to put full stop
there you have it. your way.So much processing power? I think I would love to disagree.
How many devices today aren't slow? How much time does it take for your phone to start? How long does it take to start an application?
How about other devices - such as your DVD, your DVD recorder, etc, etc? They are all SLOW. And gee, I do wonder why.
Perhaps there isn't as much processing power as we through there was.
the folks here are trying to squeeze every single instruction and the program is running slow not because of micro processor but dvd, cd, hard disk and nic and user input and what not.
sorry. to both Bee and Elysia. i am a non native english speaker (?) writer. so those of you who are also not native english men and women will find it hard to read. i will use more punctuation words if i learn.I do so agree
As someone pointed out, there are systems that are not always able to provide you with memory protection since you might technically own all memory.
And you still missed the point where I said you could still own the memory you accidentally access. Even on Windows, I can corrupt my program's variables by writing past the end of an array and the program could appear to run properly.
You're displaying horrible ignorance here, in addition to mixing up the responsibilities of the hardware, software, and languages.
Language standards like those for C and C++ left many things undefined so as not to restrict the language for the type of hardware and OS that it may be used in conjunction with. In other words, if C++ demands bounds checking, but the hardware is not capable of it, or the OS doesn't take advantage of such ability in the hardware, then by nature C++ functionality is broken on this particular system.
And for that matter, why do you need a system to check boundaries in this manner to be guarenteed as part of the language? You already know that for all intents and purposes, if you access memory out of bounds, that means you messed up as a programmer, and furthermore, your program is not correct. This is why it is left as being undefined. This way, various systems that have the ability to provided these features can provide it, while those that can't can still support C++.
There is a lot more to consider than just complaining about bounds checking not being inherent in C++. You could always try to use some sort of class of a data structure that will protect you from yourself, but for pure arrays, this is something beyond what C++ was technically designed for.
Every language has grammar rules. Every language (except for some like Japanese or Chinese), have punctuation, commas, and so on. They are your friend. Use them.
Punctuation is very important. When a sentence ends, use it.
Maybe. Maybe not.
But I don't like too much processing power being wasted on bloated applications.
Are you sure? Is that why it takes forever to start something or start a program?
It's because of the slow processor. And therefore, we shouldn't use Java on those platforms. We should use C/C++ for greatest potential speed.
first of all. well said my friend.
dunno if they have STL.
i bet they do not.
so a moooot point.
no excuse for keeping [] of vector unsafe.
i can see that. thanks for reminding.And you still missed the point where I said you could still own the memory you accidentally access. Even on Windows, I can corrupt my program's variables by writing past the end of an array and the program could appear to run properly.
just expecting a little sense of common sense. nothing much.You're displaying horrible ignorance here, in addition to mixing up the responsibilities of the hardware, software, and languages.
that is. in short. pain of using languages that get compiled to native binary.Language standards like those for C and C++ left many things undefined so as not to restrict the language for the type of hardware and OS that it may be used in conjunction with. In other words, if C++ demands bounds checking, but the hardware is not capable of it, or the OS doesn't take advantage of such ability in the hardware, then by nature C++ functionality is broken on this particular system.
And for that matter, why do you need a system to check boundaries in this manner to be guarenteed as part of the language? You already know that for all intents and purposes, if you access memory out of bounds, that means you messed up as a programmer, and furthermore, your program is not correct. This is why it is left as being undefined. This way, various systems that have the ability to provided these features can provide it, while those that can't can still support C++.
There is a lot more to consider than just complaining about bounds checking not being inherent in C++. You could always try to use some sort of class of a data structure that will protect you from yourself, but for pure arrays, this is something beyond what C++ was technically designed for.
I don't get the Java/C++ discussion. For some applications, in particular the scientific computing (image processing, numerical analysis), Java just is not fast enough (let's not speak about programming techniques or the language itself). But graphical user interfaces etc I would never program in C++ but always in java.