Why I hate C++
-
some_array[value];
[] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.
-
some_array[value];
[] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.
-
some_array[value];
[] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.
Hey! You can do stupid things in any language, if you try hard. Back in my FORTRAN days, I discovered you could write self modifying code with judicious misuse of COMMON ... you can't do it now, but back then? Handy... :cringe:
Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
-
It's not C++, it's the programmers. I use C++ and don't do that s**t.
GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
And this 20 year old code base has evidently seen some right clowns have a go at it!
-
And this 20 year old code base has evidently seen some right clowns have a go at it!
Any 20 years old code base saw its sharse of clowns, especially the self-taught enthusiast that follow any "guru" blindly. I had such a colleague, luckily he went out slamming the door... unfortunately he had 10 years to make damages. I recently had to update some of his code and I was happy that he was no longer in my proxymity or I would be writing this from behind bars.
GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
-
some_array[value];
[] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.
-
It's not C++, it's the programmers. I use C++ and don't do that s**t.
GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
While I agree with your statement, std::map implements this very [] operator overload as described. Actually that comment is a nice addition. Would I implement something like that though? probably not.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
-
Hey! You can do stupid things in any language, if you try hard. Back in my FORTRAN days, I discovered you could write self modifying code with judicious misuse of COMMON ... you can't do it now, but back then? Handy... :cringe:
Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
OriginalGriff wrote:
if you try hard.
And the lazies use VB.
-
some_array[value];
[] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.
Operator overloading can result in some of the worst abuses of the language. Usually the overloads are intuitive and reduce your typing but they can be easily taken beyond that into the realm of the absurd. I recently wrote my own little vector and matrix library for 3D graphics and there are some overloads in it that I think are sensible. For example, I have a point class that stores three coordinates and it has an [] overload that returns the coordinate at that index. This lets you write point[index] instead of point.coordinates[index]. That makes sense to me and I would not want it to do anything else behind the scene. The example you cite is beyond what I consider to be intuitive. It would be best to have explicit methods to implement that functionality instead of an overridden operator in my opinion. I don't hate C++ at all. What I hate is when people try to get cute with it as in your example. I don't think it enhances the readability or maintainability of the code at all if one has to figure out what is going with a statement like that.
-
some_array[value];
[] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.
-1 for blaming an excellent tool when the real problem lies with (s)he who uses it...
History is the joke the living play on the dead.
-
some_array[value];
[] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.
What you should really be hating on is the abhorrent coder not the language. That's like hating the hammer that was used to build the crappy shack you live in.
#SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
-
Hey! You can do stupid things in any language, if you try hard. Back in my FORTRAN days, I discovered you could write self modifying code with judicious misuse of COMMON ... you can't do it now, but back then? Handy... :cringe:
Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
OriginalGriff wrote:
FORTRAN
OriginalGriff wrote:
self modifying code
OriginalGriff wrote:
misuse of COMMON
What. The. :elephant:.
Software Zen:
delete this;
-
some_array[value];
[] is over ridden and is commented as // find element matching _Keyval or insert with default mapped Which actually means 'insert it at the end of the list'. Why not a function called 'add_to_map_at_end'? Christ I hate C++ sometimes, it is so up its arse pointless at times.
There may be reasons to dislike C++, but surely this one is a programmer induced problem. :~
Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com
-
OriginalGriff wrote:
FORTRAN
OriginalGriff wrote:
self modifying code
OriginalGriff wrote:
misuse of COMMON
What. The. :elephant:.
Software Zen:
delete this;
COMMON allowed you to share variables between different blocks of code: much like a C++ global variable being accessible from different classes. But ... it wasn't type checked, so you could declare a float and then use COMMON to import it as a 7 dimensional array of BYTE values if you wanted. Because the array bounds checking worked on the data as declared in the COMMON statement with no actual reference back to the original variable, you could happily use it to access any location in your memory space. And because there was no physical separation between code and data segments (flat memory model in those days) your code was not in a "read only partition" as code is now. Provided you understood machine code you could revise your program while it was running ... :laugh:
Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
-
COMMON allowed you to share variables between different blocks of code: much like a C++ global variable being accessible from different classes. But ... it wasn't type checked, so you could declare a float and then use COMMON to import it as a 7 dimensional array of BYTE values if you wanted. Because the array bounds checking worked on the data as declared in the COMMON statement with no actual reference back to the original variable, you could happily use it to access any location in your memory space. And because there was no physical separation between code and data segments (flat memory model in those days) your code was not in a "read only partition" as code is now. Provided you understood machine code you could revise your program while it was running ... :laugh:
Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
-
We committed some serious atrocities in the name of efficiency back then. :-O
Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
-
We committed some serious atrocities in the name of efficiency back then. :-O
Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
Not as much for speed - more to overcome space limitations. I am too young to have any PDP-8 experience, but an older colleauge told that every single one of the 4094 memory locations - 12 bit data values, 12 bit addresses - was precious. If you had to use a constand, you would always look through the entire binary program to see if the value was already used somewhere, usually as an instruction code, rather that wasting a whole 12 bit word on a duplicate... Yet, with 4096 twelve-bit words, they managed to make a complete newspaper typesetting system (they had hand coded a segment swapping system to read code from a 5 Mbyte (later: 10 Mbyte) disk. Only once did a customer demand all the options, and they couldn't fit all the resident parts into RAM. So they sold that newspaper a 2-CPU solution: When a function in CPU 1 needed to call some code that couldn't fit it, it raised an interrupt signal to CPU 2, the interrupt ID identifying the required function, and went to sleep while CPU 2 was working. Return from the function, in CPU 2, generated an interrupt back to CPU 1, interrupt ID being the result status, so that CPU 1 would wake up and continue its work... I heard about this around 1980, at a time when the PDP-8s had been replaced by PDP-11s serveral years ago, so I guess the story dates to around 1970 ("Computer Techniques A/S", later renamed "Comtec AS", was founded in 1967).
-
Hey! You can do stupid things in any language, if you try hard. Back in my FORTRAN days, I discovered you could write self modifying code with judicious misuse of COMMON ... you can't do it now, but back then? Handy... :cringe:
Sent from my Amstrad PC 1640 Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
When structured languages (like Algol, Pascal etc) came onto the scene, we used to say that "You can program FORTRAN in any language". Around 1980. a professor in the Mecanical Engineering Department and eager FORTRAN coder wrote an article for the newsletter from the University Computing Center, with a fierce attack on this silly idea of indenting loops and conditional blocks (when programming in these new languages). Like in a book: All text is left justified, starting at the margin. You can't make it consistent anyway, if you, say, have a labeled statement in that indented part: Any jump to that label would break the idea of this indented block being a coherent unit... Or something like that. I believe I still have that newsletter in my archives. I really should dig it up to see if he had any valid arguments at all. He probably didn't. I can't imagine what they would be.
-
There may be reasons to dislike C++, but surely this one is a programmer induced problem. :~
Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com
One reason to dislike C(++) is that it provides excellent tools for a programmer to make a mess in a very simple way. In the earlier days, you could see quite a few horrible cases of poiner arithmetic - and the programmers were proud of it, proud of how they could do things that were impossible in toy languages like Pascal that gave you a slap on your fingers for just addressing outside the array limits, and introducing artificial differences between a pointer to the start of an array and the array itself. Every knowledgeabler person should know that they are the same! Fortunately, intricate pointer arithmetic is no longer the way to prove your skills. OO techniques has been more popular for that for at least 15-20 years. Virtual functions and overrides may be terribly abused, too, and what is the big difference bewtween operator overloading and virtual functions, at the conceptual level?
-
OriginalGriff wrote:
if you try hard.
And the lazies use VB.
I remember "PEEK(address)" and "POKE address, value" as dearly loved functions, but that was in the DOS days. If my memory is correct, it never made it into Visual Basic, though. (I guess it would be more or less meaningless, too, considering the memory management of Windows.)