Click here to Skip to main content
15,906,094 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Why I hate C++ Pin
TheGreatAndPowerfulOz13-Jul-18 8:04
TheGreatAndPowerfulOz13-Jul-18 8:04 
GeneralRe: Why I hate C++ Pin
Munchies_Matt14-Jul-18 4:35
Munchies_Matt14-Jul-18 4:35 
GeneralRe: Why I hate C++ Pin
TheGreatAndPowerfulOz14-Jul-18 7:42
TheGreatAndPowerfulOz14-Jul-18 7:42 
GeneralRe: Why I hate C++ Pin
Munchies_Matt14-Jul-18 19:20
Munchies_Matt14-Jul-18 19:20 
GeneralRe: Why I hate C++ Pin
Nish Nishant13-Jul-18 9:47
sitebuilderNish Nishant13-Jul-18 9:47 
GeneralRe: Why I hate C++ Pin
kalberts14-Jul-18 3:47
kalberts14-Jul-18 3:47 
GeneralRe: Why I hate C++ Pin
Munchies_Matt14-Jul-18 21:44
Munchies_Matt14-Jul-18 21:44 
GeneralRe: Why I hate C++ Pin
kalberts15-Jul-18 23:13
kalberts15-Jul-18 23:13 
Munchies_Matt wrote:

This is a problem in any language, and exactly what I am getting at here.l C++ give bedroom nerd programmers who think complexity is good the chance to do this.
Sure every programming language has facilities that may be abused. Some has more such "options" than others. Take pointer arithmetic: You can do that in C an C++, but not in C#. Adressing out of array bounds (deliberately or accidentally) you can do in C, but not in Pascal. Silent fall through in a switch statement you can do in C, but neither in Pascal (no fallthrough at all) or C# (explicit). Dividing 'B' by 2 to get an exclamation mark: Allowed in C, not in properly typed languages.

Fortran had its 'facilities', such as common blocks and GOTOs. Actually, most languages do provide labels and GOTO, but I don't think I have programmed a single GOTO in my 35 years as a programmer, and I have hardly ever come across code that uses is. At least not after that 101 Elementary Programming as as freshman at the U, which was taught in Fortran (the next year they switched to Pascal).

Other languages, too, can be abused. But languages do vary a lot in how much effort it takes to get to those misbehaviour features (I think you could do pointer arithmetic tricks in "unsafe" C#, and many Pascal compilers lets you turn off the array index checking).

It also varies a lot what is commonly accepted programming style in textbook examples, widely distributed open source code etc. For C, you see things like (usually unsafe) pointer arithmetic, or pro forma arrays of length 0 because they will be arbitrarily indexed out of bounds etc. Fortran examples could have lots of labels and GOTOs, and so could Basic, but you would rarely if ever see a GOTO in a Pascal or C# textbook.

You may be a "clever" C programmer able to "prove" that you can do the same nasty things in a more strictly typed language, a language lacking explicit pointers, etc. "So that other language is just as bad as C". No, it isn't, if you have to be an expert and do special tricks that noone does by accident.

In C (/C++) you might do things by accident or delibrately, and a bystander will be unable to distinguish between them. You need not do anything to "allow" neither switch fallthrough, out-of-bounds indexing or pointer arithmetic. Many other languages are far more helpful, trying to guide you not to do silly things. C is a "you asked for it, you got it"-language.
GeneralRe: Why I hate C++ Pin
kalberts16-Jul-18 0:39
kalberts16-Jul-18 0:39 
GeneralRe: Why I hate C++ Pin
11917640 Member 14-Jul-18 21:30
11917640 Member 14-Jul-18 21:30 
GeneralRe: Why I hate C++ Pin
KBZX500016-Jul-18 2:34
KBZX500016-Jul-18 2:34 
GeneralRe: Why I hate C++ Pin
Munchies_Matt16-Jul-18 3:04
Munchies_Matt16-Jul-18 3:04 
GeneralRe: Why I hate C++ Pin
KBZX500017-Jul-18 21:32
KBZX500017-Jul-18 21:32 
GeneralRe: Why I hate C++ Pin
englebart16-Jul-18 3:40
professionalenglebart16-Jul-18 3:40 
GeneralRe: Why I hate C++ Pin
Andy Hoffmeyer16-Jul-18 3:51
Andy Hoffmeyer16-Jul-18 3:51 
GeneralRe: Why I hate C++ Pin
Munchies_Matt16-Jul-18 4:03
Munchies_Matt16-Jul-18 4:03 
GeneralRe: Why I hate C++ Pin
Steve Naidamast16-Jul-18 4:08
professionalSteve Naidamast16-Jul-18 4:08 
GeneralScrum: 1518 ? Pin
BillWoodruff13-Jul-18 2:37
professionalBillWoodruff13-Jul-18 2:37 
GeneralRe: Scrum: 1518 ? Pin
Rage13-Jul-18 3:03
professionalRage13-Jul-18 3:03 
GeneralRe: Scrum: 1518 ? Pin
MacSpudster13-Jul-18 9:23
professionalMacSpudster13-Jul-18 9:23 
GeneralRe: Scrum: 1518 ? Pin
BillWoodruff13-Jul-18 21:38
professionalBillWoodruff13-Jul-18 21:38 
GeneralWatching a horror movie... Pin
CodeWraith13-Jul-18 2:06
CodeWraith13-Jul-18 2:06 
GeneralRe: Watching a horror movie... Pin
OriginalGriff13-Jul-18 2:31
mveOriginalGriff13-Jul-18 2:31 
GeneralRe: Watching a horror movie... Pin
CodeWraith13-Jul-18 2:56
CodeWraith13-Jul-18 2:56 
GeneralRe: Watching a horror movie... Pin
OriginalGriff13-Jul-18 4:17
mveOriginalGriff13-Jul-18 4:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.