Click here to Skip to main content
15,887,083 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
AnswerRe: English question Pin
kmoorevs14-Oct-17 8:34
kmoorevs14-Oct-17 8:34 
GeneralRe: English question Pin
Brisingr Aerowing17-Oct-17 14:53
professionalBrisingr Aerowing17-Oct-17 14:53 
AnswerRe: English question Pin
kl8r812-Jun-18 1:48
kl8r812-Jun-18 1:48 
GeneralHere's one I just wrote myself Pin
Duncan Edwards Jones11-Oct-17 23:06
professionalDuncan Edwards Jones11-Oct-17 23:06 
GeneralRe: Here's one I just wrote myself Pin
raddevus12-Oct-17 2:09
mvaraddevus12-Oct-17 2:09 
GeneralRe: Here's one I just wrote myself Pin
Duncan Edwards Jones12-Oct-17 2:30
professionalDuncan Edwards Jones12-Oct-17 2:30 
GeneralRe: Here's one I just wrote myself Pin
megaadam12-Oct-17 2:45
professionalmegaadam12-Oct-17 2:45 
RantThe C++ primer 5th Edition (by Lippman ), an example of bad way to express something. Pin
geodoom11-Oct-17 11:35
geodoom11-Oct-17 11:35 
So I have started reading the book , and on chapter 6 Functions, 6.3 Return Types and the return statement, he says :
"Return from main
There is one exception to the rule that a function with a return type other than
void must return a value: The main function is allowed to terminate without a
return. If control reaches the end of main and there is no return, then the compiler
implicitly inserts a return of 0".

And I am thinking :
What? Why mr. Lippman ? why do you have to express a simple idea in such a complicated way , and mention something that is on the edge of inaccuracy ? You should say :
There is NO exception to the rule that a function with a return type other than
void must return a value. But because we , the programmers , do not like to type things when not necessary , the compiler lets us omit typing explicitly the return 0; in function main.So instead of
C++
int main() {
//some code here
return 0;
}

you are allowed to type
C++
int main() {
//your code 
}

and the compiler will happily insert the implicit return 0; so main() returns a value as it should.
I know it is slightly longer as text , but it is what you should mention.

I have many other examples from this book on which I could complain. Generally it is a correct book , and anyone who wants to learn C++ cannot avoid it, but although the information is there (and it is correct) it always fails to present that information in a way that will help you to remember it , or fails to aid in categorizing and summarizing the new information. I constantly feel that the only way for this book to be useful is to use it as a primary trustful source for writing my own notes (and they would be as many pages as the book !). But anyway , I am doing all the exercises , and keep reading.
I plan to read on parallel the book from I.Horton, Beginning C++ (2015 edition) to get some coverage for C++14.

modified 11-Oct-17 17:41pm.

GeneralRe: The C++ primer 5th Edition (by Lippman ), an example of bad way to express something. Pin
den2k8811-Oct-17 22:04
professionalden2k8811-Oct-17 22:04 
GeneralRe: The C++ primer 5th Edition (by Lippman ), an example of bad way to express something. Pin
PeejayAdams11-Oct-17 23:49
PeejayAdams11-Oct-17 23:49 
GeneralRe: The C++ primer 5th Edition (by Lippman ), an example of bad way to express something. Pin
den2k8812-Oct-17 3:30
professionalden2k8812-Oct-17 3:30 
GeneralRe: The C++ primer 5th Edition (by Lippman ), an example of bad way to express something. Pin
megaadam12-Oct-17 3:59
professionalmegaadam12-Oct-17 3:59 
GeneralRe: The C++ primer 5th Edition (by Lippman ), an example of bad way to express something. Pin
madwilliamflint23-Oct-17 4:49
madwilliamflint23-Oct-17 4:49 
GeneralWhen variable names in C# get weird PinPopular
harold aptroot26-Sep-17 1:55
harold aptroot26-Sep-17 1:55 
GeneralRe: When variable names in C# get weird Pin
raddevus26-Sep-17 2:23
mvaraddevus26-Sep-17 2:23 
GeneralRe: When variable names in C# get weird Pin
Kornfeld Eliyahu Peter26-Sep-17 2:39
professionalKornfeld Eliyahu Peter26-Sep-17 2:39 
GeneralRe: When variable names in C# get weird Pin
OriginalGriff26-Sep-17 2:51
mveOriginalGriff26-Sep-17 2:51 
GeneralRe: When variable names in C# get weird Pin
harold aptroot26-Sep-17 2:57
harold aptroot26-Sep-17 2:57 
GeneralRe: When variable names in C# get weird Pin
OriginalGriff26-Sep-17 3:08
mveOriginalGriff26-Sep-17 3:08 
GeneralRe: When variable names in C# get weird Pin
RugbyLeague26-Sep-17 4:30
RugbyLeague26-Sep-17 4:30 
GeneralRe: When variable names in C# get weird Pin
Nicholas Marty26-Sep-17 4:47
professionalNicholas Marty26-Sep-17 4:47 
GeneralRe: When variable names in C# get weird Pin
raddevus27-Sep-17 2:02
mvaraddevus27-Sep-17 2:02 
GeneralRe: When variable names in C# get weird Pin
Nathan Minier28-Sep-17 1:59
professionalNathan Minier28-Sep-17 1:59 
GeneralRe: When variable names in C# get weird Pin
Richard Deeming28-Sep-17 3:43
mveRichard Deeming28-Sep-17 3:43 
GeneralRe: When variable names in C# get weird Pin
Nathan Minier28-Sep-17 3:47
professionalNathan Minier28-Sep-17 3:47 

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.