![]() |
|
|
|
|
|
|
3
26th October 13:41
External User
Posts: 1
|
That advice is not automatically correct, for all the real-world compilers
and situations out there. Always. <stdio.h> truly has nothing left in it that anyone should use in C++! -- Phlip http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!! |
|
|
9
26th October 13:45
External User
Posts: 1
|
Unfortunately, many popular compilers incorrectly implement the <cxxx>
headers to put C library names in _both_ the std namespace and the global namespace. As well as adding nothing in terms of namespace protection, it means that this program usually compiles #include <cstdio> int main() { printf("Hello world\n"); // missing std:: prefix } The compiler doesn't catch the error and in a less trivial program I might not catch it either. Unless and until compilers start to widely implement <cxxx> headers correctly, I prefer to use <xxx.h>. Though technically deprecated, this program will compile and do what I intend on any conforming compiler. #include <stdio.h> int main() { printf("Hello world\n"); } As a practical matter, I can't believe <xxx.h> headers will move from deprecated to excluded from the language while correct implementation of <cxxx> headers is so sparse. Also see P J Plauger's comments in this thread http://groups.google.co.uk/group/com...7e988ec38576f6 or, while the link lasts http://tinyurl.co.uk/o2im Gavin Deane |
|
|
10
30th October 14:32
External User
Posts: 1
|
You think so? What else does the C++ library provide to replace:
rename()? remove()? tmpfile()? tmpnam()? FILENAME_MAX? Some of the other types and macros are arguable, but the four functions and one macro above can be very, very useful in C++ programs. -- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://c-faq.com/ comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.learn.c-c++ http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html |
|