Power

This is a discussion on Power within the C++ Programming forums, part of the General Programming Boards category; Wait, surely, Schildt must be an experienced programmer to write such books. He has written alot, too. On the cover ...

  1. #16
    Registered User MathFan's Avatar
    Join Date
    Apr 2002
    Posts
    190
    Wait, surely, Schildt must be an experienced programmer to write such books. He has written alot, too. On the cover of my book it says that "he is one of the most popular authors" and has sold "more than 2.5 million books".

    But how then can he be wrong in so many cases and even contradictory to the standard? Aren't there some people that chack the book for errors before it's published?
    The OS requirements were Windows Vista Ultimate or better, so we used Linux.

  2. #17
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by CornedBee
    What Dae just said is wrong. There never was a cmath.h header in any standard. From the very beginning, the C++ standard contained math.h and cmath.
    Its correct for some of the header files. I didnt know if cmath was one of those though (he said iostream). Regardless, they removed the .h and maybe changed the file name a tiny bit.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  3. #18
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    The CRT headers were "imported" into the C++ standard by removing the .h and prepending a c. The new C++ headers simply were created without a .h, as far as the standard is concerned. In practice, many of the C++ headers were headers that older compilers commonly used, with the .h removed.

    Anyway, Dae, it doesn't change the fact that the standard was never changed. It wasn't TR1 (released in 2001) that changed the ending. So what you wrote was still wrong. And your "because" was also incorrect, because what you posted was an incorrect answer to the given question.

    I'm not in a mood to be argued against, so you better be damn sure you've got your facts straight
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #19
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Alright, better stop reading other peoples posts and only read yours then, because thats what I read. Sorry.

    The CRT headers were "imported" into the C++ standard by removing the .h and prepending a c. The new C++ headers simply were created without a .h, as far as the standard is concerned. In practice, many of the C++ headers were headers that older compilers commonly used, with the .h removed.
    So when <c___> showed up it was because they imported some other header, but made it so in practice it was similar to the use of <___.h>? If it wasnt already there already (which you said <cmath> has been around since the beginning) So what about <iostream>? it uses namespaces now, and has cout and stuff, so its an "import" too? when did they do that.. was it somewhat 4 years ago? or further back and people just didnt notice when they were making C++ books.
    Last edited by Dae; 06-22-2005 at 04:39 PM.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  5. #20
    Registered User
    Join Date
    Jan 2005
    Posts
    7,338
    Before C++ had a standard, most compilers used <iostream.h>, <fstream.h>, <new.h>. etc for the C++ library headers. They also used <math.h>, <stdio.h>, <stdlib.h>, <time.h>, etc for the C library headers. The C library headers were already standard for the C language, so the same ones were used before C++ had a standard.

    Then, in 1998, C++ got its first and only standard so far. In that standard, the headers used for the C++ libraries were <iostream>, <fstream>, <new>, etc. No mention was made of the old C++ headers, they were simply ignored and are non-standard. The C library headers were made part of the standard, so <math.h>, <stdlib.h>, etc are standard in C++. However, they were deprecated by the C++ standard. That means that you are allowed to use them, but it is recommended that you use the alternatives because some time in the future the deprecated versions might be removed from the standard. The new versions of the C library headers are <cmath>, <cstdio>, <cstdlib>, <ctime>, etc.

    So, from the beginning of the C++ standard, the header files without the .h were the preferred ones. C++ was used before it was standardized, which is why many people are still confused about which headers to use.

    In addition, the old C++ headers (like <fstream.h>) are different than the standard headers. You should not just mix and match. The deprecated C headers (like <math.h>) are the same as the new version (like <cmath>) except for the namespace changes. So in most cases, it doesn't matter in practice which C library header you use. If you have a choice, pick the new version.
    Last edited by Daved; 06-22-2005 at 04:55 PM.

  6. #21
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Oh thanks Daved, that clears it up a lot.

    So thats why.. because the C++ standard was made in 1998, tricky.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  7. #22
    Registered User
    Join Date
    Jan 2005
    Posts
    7,338
    Someone who says that "they changed the headers" really means that they used different headers than the ones that had been used traditionally beforehand. It is a subtle difference that can easily be confused.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem With My Box
    By HaVoX in forum Tech Board
    Replies: 9
    Last Post: 10-15-2005, 07:38 AM
  2. No Power, but power being supplied.
    By jrahhali in forum Tech Board
    Replies: 6
    Last Post: 08-11-2005, 02:50 AM
  3. The destructive power of a nuclear bomb
    By InvariantLoop in forum A Brief History of Cprogramming.com
    Replies: 30
    Last Post: 03-24-2005, 01:46 AM
  4. Power supplies and demanding processors
    By Liger86 in forum Tech Board
    Replies: 12
    Last Post: 03-17-2005, 10:56 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21