| | |
complete(mostly) list of differences between c , c++ and related stuff.
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2006
Posts: 50
Reputation:
Solved Threads: 0
The differences are listed here
http://www.geocities.com/karthika_79/diff.html
hope this helps,
karthika
http://www.geocities.com/karthika_79/diff.html
hope this helps,
karthika
Aside from being difficult to read against that background, an awful lot of that makes no sense, is innacurate or completely wrong.
return types are never defaulted to anything. the standard specifies that main must return an int, however, it is not valid to simply write your function signature without explicitly specifying a return type.
That's not true for either C or C++. Array elements which are uninitialised remain uninitialised. To access an uninitialised variable or array element is undefined behaviour.
•
•
•
•
return type of main and any function is defaulted to int.(0 if success and 1 if failure)
•
•
•
•
Array elements that donot have initializers are assigned '0'.
Last edited by Bench; Dec 19th, 2006 at 9:00 pm.
¿umop apisdn upside down? •
•
•
•
The differences are listed here
http://www.geocities.com/karthika_79/diff.html
hope this helps,
karthika
http://david.tribble.com/text/cdiffs.htm
•
•
Join Date: Sep 2006
Posts: 50
Reputation:
Solved Threads: 0
•
•
•
•
Aside from being difficult to read against that background, an awful lot of that makes no sense, is innacurate or completely wrong.
return types are never defaulted to anything. the standard specifies that main must return an int, however, it is not valid to simply write your function signature without explicitly specifying a return type.
That's not true for either C or C++. Array elements which are uninitialised remain uninitialised. To access an uninitialised variable or array element is undefined behaviour.
1.Arrays that are static or global are initialized with zeros if no values are mentioned. You can check this out in http://www.cplusplus.com/doc/tutorial/arrays.html
2.Main and other functions default to int return type. ISO standard requires main to be return type int always.I accept. But my compiler and my friends compiler didnot complain when main was not specified with returntype int..though its not standard C++ programming, You can see tutorials and books still with code like
main()
{....
return 0;
}
For example (main): http://www.cs.uregina.ca/Dept/manual..._18C++/c++.htm
(other functions) : http://jupiter.clarion.edu/~rsmaby/cis254/introcpp.html
http://cs.nmhu.edu/personal/curtis/c...ntialssec3.htm
Though you were not polite to ask me to check,I appreciate your valuable inputs. I understand what you meant.It was just an ambiguity which I now madeup by putting a Note there. Thanks a lot.
•
•
Join Date: Sep 2006
Posts: 50
Reputation:
Solved Threads: 0
Check by YourSelf
The above is an elaborate explanation on incompatibilities..A good source of info.
This is ofcourse a good quick reference of differences for novices
http://www.geocities.com/karthika_79/diff.html
The above is an elaborate explanation on incompatibilities..A good source of info.
This is ofcourse a good quick reference of differences for novices
http://www.geocities.com/karthika_79/diff.html
•
•
•
•
Please verify anything before you post.
1.Arrays that are static or global are initialized with zeros if no values are mentioned. You can check this out in http://www.cplusplus.com/doc/tutorial/arrays.html
And I wonder why that was. It was because YOU didn't specify that it's only global and static arrays, not him, and so your post is actually incorrect, unless you specifically state that it's only global and static members.
•
•
•
•
2.Main and other functions default to int return type. ISO standard requires main to be return type int always.I accept. But my compiler and my friends compiler didnot complain when main was not specified with returntype int..though its not standard C++ programming, You can see tutorials and books still with code like
main()
{....
return 0;
}
For example (main): http://www.cs.uregina.ca/Dept/manual..._18C++/c++.htm
(other functions) : http://jupiter.clarion.edu/~rsmaby/cis254/introcpp.html
http://cs.nmhu.edu/personal/curtis/c...ntialssec3.htm
Though you were not polite to ask me to check,I appreciate your valuable inputs. I understand what you meant.It was just an ambiguity which I now madeup by putting a Note there. Thanks a lot.
•
•
•
•
Check by YourSelf
The above is an elaborate explanation on incompatibilities..A good source of info.
This is ofcourse a good quick reference of differences for novices
http://www.geocities.com/karthika_79/diff.html
"Technological progress is like an axe in the hands of a pathological criminal."
•
•
•
•
2.Main and other functions default to int return type. ISO standard requires main to be return type int always.I accept. But my compiler and my friends compiler didnot complain when main was not specified with returntype int.
void main() - implementations which conform more strictly to the standard are well within their right to complain about this (And some do!).If you intend your site to be used as a reference for beginners, then may I suggest that you make no assumptions about what compiler your visitors might be using. or whether or not they are compiling in a mode which adheres strictly to the standard.
¿umop apisdn upside down? •
•
Join Date: Sep 2006
Posts: 50
Reputation:
Solved Threads: 0
•
•
•
•
Just because something works on your compiler or your friend's compiler doesn't mean that it will work on other people's. Compilers are allowed to work in ways which aren't defined by the standard, such as allowingvoid main()- implementations which conform more strictly to the standard are well within their right to complain about this (And some do!).
If you intend your site to be used as a reference for beginners, then may I suggest that you make no assumptions about what compiler your visitors might be using. or whether or not they are compiling in a mode which adheres strictly to the standard.
•
•
Join Date: Sep 2006
Posts: 50
Reputation:
Solved Threads: 0
•
•
•
•
Although it is true that static and global array are initalized with 0, you failed to mention that in the differences list. And since Bench assumed you were referring to local arrays, which are completely random, he was correct in saying that elements will remain unitialized until you put values into them.
It's still not correct to neglect a return type on main(), even if the compiler doesn't complain. For example, Visual C++ didn't (I'm not sure if it still does; I think so) complain about void main(). Does that mean it's correct? Of course not, it never has been, and probably never will be. So you can't always rely on compilers to be correct.
Your background makes it very hard to read, and it's highly unlikely any newbies will stop very long trying to make out the words that are barely visible against the low constrast.
I did read it, and am restating it to emphasize the point. My point was that if you have a hard-to-read background, it actually discourages newbies who are going to read your "quick reference". It also doesn't make your site look professional, like a site should be that will attract newbies.
"Technological progress is like an axe in the hands of a pathological criminal."
![]() |
Other Threads in the C++ Forum
- Previous Thread: composition
- Next Thread: missing storage-class or type specifiers error
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count database delete deploy desktop developer directshow dll dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph homeworkhelp homeworkhelper iamthwee ifstream input int integer lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






