Talk:C++ Programming/Programming Languages/C++/Code/Statements/Flow Control

Goto Example
What should be done about the example of "proper" use of gotos... I've cleaned it up a bit so that it's actually valid C++ (explicit pointer casts), but...


 * The code uses malloc/free and fprintf/stderr instead of new/delete and cerr, so it's not very sensible in a C++ wikibook.
 * exceptions might be more "proper" in the case of C++ for that. (Admittedly, I'm not all that fond of exceptions, but meh.)
 * If I recall correctly, the current standard has new throw an exception anyway instead of returning NULL, so cleaning it to be in C++-style makes the example wrong.
 * Isn't it convention to just say 0 instead of NULL in C++? Not sure about that, as my native language is actually C. --Dnas 03:40, 18 February 2007 (UTC)
 * I've fixed it to use new/delete and cerr. I've made it use the nothrow form of new so that it returns NULL. That deals with two of the problems. While it may be true that exceptions are generally preferred over using goto, goto is allowed in C++ and so an example is still needed. IIRC, NULL is defined as being 0 in C++ and people use it for some level of compatibility with C and to make it clear that the variable is a pointer without having to search for where the variable is declared. --dark [[Image:Yin yang.svg|12px]] lama 15:12, 23 February 2007 (UTC)

Please move the fork example to someother section as it is UNIX specific and not part of standard C/C++. Jayaram Ganapathy


 * I think malloc/free and fprintf/stderr  should have a section before the goto explaining what they are since we can use them as part of the C++ (and point reasons why you shouldn't), take a look into the C Programming book and see if we can use something from it, we already have given attribution from content from there so we can copy anything we can use.
 * Add info to take a look to the exception information and point to the page.
 * You we should avoid NULL but some take an exception on the "avoid macros" on null because it is easier to remember (visually) why you used a NULL (if you do it as a rule), I myself turn every NULLs into 0s :) --Panic 17:39, 12 April 2007 (UTC)


 * Jayaram Ganapathy, fork is the same as split it has noting to do with Unix on that context, I think you are referring to the if information. --Panic 17:41, 12 April 2007 (UTC)

Duplication
I noticed a bit of duplication: C Programming/Control. Both this page and the link share significant scope and content, but in my opinion this version seemed to skip some content. Should we copy/paste to bring them back together, or should be work on this page to make it better? --Sigma 7 (talk) 01:25, 17 January 2009 (UTC)


 * It is no duplication, the pages belong to distinct books/languages, you can merge useful content into this one (we already acknowledge the C Programming book for some content) you can also take a look into the java book and other programming languages for useful content, if you do copy from them in quantity add an acknowledgment to the authors page or if creating a new page ask an administrator to merge the the edit history (similar to a transwiki request). --Panic (talk) 19:11, 17 January 2009 (UTC)

Clarity
I feel a little strange just marching in and changing text here, so would rather offer an idea for others to consider..

The text "There is likely no meaningful program written in which a computer does not demonstrate basic decision-making skills." I find a bit difficult to understand as it combines negatives. The subsequent "It can actually be argued that there is no meaningful human activity in which no decision-making, instinctual or otherwise, takes place." suffers from the same. May I suggest the boiled down: "Like human activity, a computer program is arguably useless unless it exercises its ability to make decisions based upon certain conditions and, hopefully, bring some value to the world in which it exists." --K1mgy (discuss • contribs) 22:05, 25 December 2011 (UTC)


 * See if you are satisfied by the little change that was inspired by you more complex phrase. Note that the idea is not to show that the capability exists, but that it is mostly prevalent. --Panic (discuss • contribs) 23:25, 25 December 2011 (UTC)