[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
talk:TurboCppHelloWorld
This page is to discuss "TurboCppHelloWorld". You can ask questions or make comments.
What is a talkpage?
deostroll
I am sure that even the oldest versions of Turbo C++ do support this as it is a great product.
References:
Oops, I am wrong: version 1.01 does not have the header file 'iostream'. Actually it only has C headers that can be called from C++ source.
But I bet that if it contains iostream, it can be called with '#include<iostream>' and then 'std::cout' will exist.
Please correct me if I'm wrong.
Another point is that you must include a .h for any header file you add. This is mandatory. I had just checked it now. When my version compiled with the line
And I think the concept of namespaces were included in the versions greater than 3.0.
Well I had a discussion about turbo c++ 3.0 in programmersheaven itself: http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=3&MsgID=323286&Setting=
So, I hope you will add some text about Turbo C++ 3.0 its not-yet-standard implemenetation, so no one will be able to 'correct' you.
Thanks for caring about your pages! See ya, Bilderbikkel
In v3.0 it is not a problem. However, what you can do is say that this is not the standard way of doing so...etc, etc. So I suggest that you add a heading called Notes after the output and fill it in. You deserve to edit this one.
I hope this is now settled, as I keep looking forward to your new contributions. See ya later, Bilderbikkel
See ya, Bilderbikkel
For the CodePedia, therefore, I'd prefer to omit it, so the code is as short as possible. It is also the reason why I write 'main()' instead of 'main(int argc, char* argv[])', to keep the code as short as possible.
But thanks for checking me on 'return 0'! I saw I did not explicitly wrote on the C++ main() page, so now I did. Also, you sound like someone who also would like to check out The C++ Standard. I really love it, as it shows one what is standard and what is not.
I look forward to more of your contributions! See ya later, Bilderbikkel
[Edit this page] [Page history] [What links here] [Printer Friendly]
talk:TurboCppHelloWorld
This page is to discuss "TurboCppHelloWorld". You can ask questions or make comments.
What is a talkpage?
Deostroll, <03-12-2006
std::cout does not work in TC++ 3.0. Maybe in the later versions it does, but this is to my good knowledge. And you have to write the header file as#include<iostream.h>
deostroll
Bilderbikkel, 03-12-2006
Indeed, calling an STL header with the .h extension will call the correct header file, but also adds 'using namespace std' (see #include). Therefore std::cout will not work after '#include <iostream.h>. It is to be preferred to '#include <iostream>' as 'using namespace std' is to be avoided, as it pollutes the global namespace [1,2].I am sure that even the oldest versions of Turbo C++ do support this as it is a great product.
References:
- 1) Bjarne Stroustrup. The C++ Programming Language (3rd edition). 1997. ISBN: 0-201-88954-4. Chapter C.14.15: 'Don't pollute the global namespace'
- 2) C++ FAQ Lite: http://www.parashift.com/c++-faq-lite/coding-standards.html#faq-27.5 :
Bilderbikkel, 03-12-2006
I am sure that even the oldest versions of Turbo C++ do support this as it is a great product.[/italic]
Oops, I am wrong: version 1.01 does not have the header file 'iostream'. Actually it only has C headers that can be called from C++ source.
But I bet that if it contains iostream, it can be called with '#include<iostream>' and then 'std::cout' will exist.
Please correct me if I'm wrong.
deostroll , 16 dec 2006
I am quite sure that the TURBO C++ 3.0 never had the concepts of namespaces associated with it. Even I am wondering how do I tell you exactly what version it is that I have. May be if chance permits I'll mail you my version as a zip file or something.Another point is that you must include a .h for any header file you add. This is mandatory. I had just checked it now. When my version compiled with the line
using namespace std;that gave me an error!!!
And I think the concept of namespaces were included in the versions greater than 3.0.
Well I had a discussion about turbo c++ 3.0 in programmersheaven itself: http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=3&MsgID=323286&Setting=
Bilderbikkel, 16 dec 2006
Hi Deostroll, thanks for your correspondence. If indeed Lundin claims that it does not have namespace, you must have been right all the way. I am sorry, but if it is so, you should -in my humble opinion- state this in your code. If you'd have written that Turbo C++ does not support namespaces, I would not have disagreed on your code. Also, as you use an 'outdated' version, it might be a good idea to state that your Hello World code is for version 3.0 or older.So, I hope you will add some text about Turbo C++ 3.0 its not-yet-standard implemenetation, so no one will be able to 'correct' you.
Thanks for caring about your pages! See ya, Bilderbikkel
deostroll 18 dec 2006
Thats right. The compiler I am talking about is rather primitive. And thinking in terms of community support, I expect few. Its not everyone that works with this compiler. But there are people that learn c++ using this outdated version. The motive behing this section is to get those people started.Bilderbikkel, 18 December 2006
Hey Deostroll, main() is of return type int (you know where to find there references)! Or is that not supported by Turbo C++ 3.0 either? Seems very unlikely to me that int main() would not compile.Bilderbikkel, 27 December 2006
Great that you add sample pages to the CodePedia! But again, main() is of return type int! See www.codepedia.com/1/CppMain for many references. If you do not correct this, I will.deostroll, 28 dec 2007
I have not experienced any problems using void main(). But have you personally experienced it? If yes, then I think it is enough you simply mention this fact in there some where so that people know...In v3.0 it is not a problem. However, what you can do is say that this is not the standard way of doing so...etc, etc. So I suggest that you add a heading called Notes after the output and fill it in. You deserve to edit this one.
Bilderbikkel, 29 Dec 2007
Please Deostroll, using void main() is plainly WRONG! The argument 'but it works for me' is plainly a wrong kind of attitude (it is non-portable) as well as a lack of knowledge of the literature (e.g. the ISO/ANSI C++ Standard (although some textbooks do use it and set a bad example)). Again, check the incomplete list of references at www.codepedia.com/1/CppMain or use Google. Although I appreciate your efforts at CodePedia a lot, even I am 'flamed' (as they call it at the Newsgroups). I am very happy that you agree that I can change it to 'int main()' and I will do so now.I hope this is now settled, as I keep looking forward to your new contributions. See ya later, Bilderbikkel
deostroll, 30 dec 2006
My point is, so what if it is a standard? I am not arguing here. Instead let people know that, void main() also works, but not with all compilers. What is wrong with giving people that bit of information? Just express what you have to, and do it clearly in an unbiased fashion. I am not stopping you. I have concurred with the links you've provided. I also agree to this standard. But do let people know that both the versions exist.Bilderbikkel, 30 dec 2006
No, the CodePedia needs to give correct and standard information. Sometimes it is okay to show how NOT to do it to give an example. But showing something that is non-standard (see ref #1) and is strongly recommended not to do by C++ FAQ Lite, Herb Sutter, Bjarne Stroustrup and the alt.comp.lang.learn.c-c++ FAQ , then in my humble opinion you either have a lot of guts, are a naive newby, or are just plain stubborn. I agree it is okay to show them 'that both versions exist', but not to use 'void main' in example code. I'll be changing 'void main' to the correct version now...See ya, Bilderbikkel
References
- 1) C++. International Standard. ISO/IEC 14882. Second edition. Paragraph 3.6.1.2
- 2) From http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.3 : main() must return int. Not void, not bool, not float. int. Just int, nothing but int, only int. Some compilers accept void main(), but that is non-standard and shouldn't be used. Instead use int main().
- 3) Herb Sutter. Exceptional C++. ISBN: 0-201-61562-2. Item 21: void main() is nonstandard and nonportable.
- 4) From Bjarne Stroustrup's homepage (http://www.research.att.com/~bs/bs_faq2.html#void-main) :
void main() { /* ... */ } is not and never has been C++, nor has it even been C.
- 5) From the The alt.comp.lang.learn.c-c++ FAQ: http://ma.rtij.nl/acllc-c++.FAQ.html#q3.4: 3.4 Why does everyone make so much fuss about "void main()"?. Because the return type of the main() function must be int in both C and C++. Anything else is undefined. Bottom line - don't try to start a thread about this in alt.comp.lang.learn.c-c++ as it has already been discussed many, many times and generates more flamage than any other topic.
deostroll 31st dec 2006
Hmm. Shouldn't there be a return statement, lest you get a compiler warning! I am not well versed with the standards, but when u said tht u were going to edit I thot you add a return 0; at the end of the program.Bilderbikkel 31st Dec 2006
According to the C++ Standard (Paragraph 3.6.1.5) the closing bracket of main() must be the same as a return zero. Therefore, I prefer to omit it. I know many people like to write return zero. This is okay, because it is not against the Standard. I've also stated this on the www.codepedia.com/1/CppMain page.For the CodePedia, therefore, I'd prefer to omit it, so the code is as short as possible. It is also the reason why I write 'main()' instead of 'main(int argc, char* argv[])', to keep the code as short as possible.
But thanks for checking me on 'return 0'! I saw I did not explicitly wrote on the C++ main() page, so now I did. Also, you sound like someone who also would like to check out The C++ Standard. I really love it, as it shows one what is standard and what is not.
I look forward to more of your contributions! See ya later, Bilderbikkel
[Edit this page] [Page history] [What links here] [Printer Friendly]
