complete(mostly) list of differences between c , c++ and related stuff.

Reply

Join Date: Sep 2006
Posts: 50
Reputation: kararu is an unknown quantity at this point 
Solved Threads: 0
kararu kararu is offline Offline
Junior Poster in Training

complete(mostly) list of differences between c , c++ and related stuff.

 
0
  #1
Dec 19th, 2006
The differences are listed here

http://www.geocities.com/karthika_79/diff.html

hope this helps,
karthika
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 519
Reputation: Bench is a jewel in the rough Bench is a jewel in the rough Bench is a jewel in the rough 
Solved Threads: 53
Bench's Avatar
Bench Bench is offline Offline
Posting Pro

Re: complete(mostly) list of differences between c , c++ and related stuff.

 
0
  #2
Dec 19th, 2006
Aside from being difficult to read against that background, an awful lot of that makes no sense, is innacurate or completely wrong.
return type of main and any function is defaulted to int.(0 if success and 1 if failure)
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.

Array elements that donot have initializers are assigned '0'.
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.
Last edited by Bench; Dec 19th, 2006 at 8:00 pm.
¿umop apisdn upside down?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 598
Reputation: SpS is on a distinguished road 
Solved Threads: 32
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Re: complete(mostly) list of differences between c , c++ and related stuff.

 
1
  #3
Dec 19th, 2006
Originally Posted by kararu View Post
The differences are listed here

http://www.geocities.com/karthika_79/diff.html

hope this helps,
karthika
Anyone following this thread, read this instead
http://david.tribble.com/text/cdiffs.htm
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 50
Reputation: kararu is an unknown quantity at this point 
Solved Threads: 0
kararu kararu is offline Offline
Junior Poster in Training

Re: complete(mostly) list of differences between c , c++ and related stuff.

 
0
  #4
Dec 20th, 2006
Originally Posted by Bench View Post
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.
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

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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 50
Reputation: kararu is an unknown quantity at this point 
Solved Threads: 0
kararu kararu is offline Offline
Junior Poster in Training

Re: complete(mostly) list of differences between c , c++ and related stuff.

 
0
  #5
Dec 20th, 2006
Originally Posted by sunnypalsingh View Post
Anyone following this thread, read this instead
http://david.tribble.com/text/cdiffs.htm
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
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,052
Reputation: John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of 
Solved Threads: 334
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: complete(mostly) list of differences between c , c++ and related stuff.

 
0
  #6
Dec 20th, 2006
Originally Posted by kararu View Post
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
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.

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.
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.

Originally Posted by kararu View Post
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
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.
"Technological progress is like an axe in the hands of a pathological criminal."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 519
Reputation: Bench is a jewel in the rough Bench is a jewel in the rough Bench is a jewel in the rough 
Solved Threads: 53
Bench's Avatar
Bench Bench is offline Offline
Posting Pro

Re: complete(mostly) list of differences between c , c++ and related stuff.

 
0
  #7
Dec 20th, 2006
Originally Posted by kararu View Post
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.
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 allowing 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?
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 50
Reputation: kararu is an unknown quantity at this point 
Solved Threads: 0
kararu kararu is offline Offline
Junior Poster in Training

Re: complete(mostly) list of differences between c , c++ and related stuff.

 
0
  #8
Dec 20th, 2006
Originally Posted by Bench View Post
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 allowing 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.
got it.no dependencies on compilers.I will put it as per standards alone.thanks.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 50
Reputation: kararu is an unknown quantity at this point 
Solved Threads: 0
kararu kararu is offline Offline
Junior Poster in Training

Re: complete(mostly) list of differences between c , c++ and related stuff.

 
0
  #9
Dec 20th, 2006
Originally Posted by joeprogrammer View Post
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 think you didnot check the link after Bench mentioned about the background.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,052
Reputation: John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of 
Solved Threads: 334
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: complete(mostly) list of differences between c , c++ and related stuff.

 
0
  #10
Dec 21st, 2006
Originally Posted by kararu View Post
I think you didnot check the link after Bench mentioned about the background.
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."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum


Views: 2369 | Replies: 9
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC