C++ youtube video

This is a discussion on C++ youtube video within the A Brief History of Cprogramming.com forums, part of the Community Boards category; It's mentioned in that lecture that Stanford has a companion course to the one that lady teaches "if you really ...

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,744
    It's mentioned in that lecture that Stanford has a companion course to the one that lady teaches "if you really want to know C++".
    Could that be the week-long summer school course once taught by Andrew Koenig and Barbara Moo as mentioned in Accelerated C++?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,706
    As snarky as that reply was, I don't know.

    The course number I believe was CIS 106L.

  3. #18
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Oh oh. She said void main() is valid in C code.

  4. #19
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,744
    She said void main() is valid in C code.
    As I recall, due to a defect in the C standard, she is technically correct, depending on the compiler.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #20
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    The C Standard currently says that an implementation is free to define any additional forms for main that it cares to. 5.1.2.2.1.1 of the C Standard lists the allowable forms for the definition of main. Because of the semi-colon, its final sentence parses as follows:

    Code:
    It shall be defined
    * with a return type of int and
       - with no parameters [...] or
       - with two parameters [...] or equivalent;
    or
    * in some other implementation-defined manner.
    If I'm reading that correctly, it looks like it's saying that all compilers are required to support int main() and int main( int argc, char* argv[] ) but that's the bare minimum they need to support. They can of course also support their own extensions, in which case code becomes non-portable.

  6. #21
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    Quote Originally Posted by ISO 9899
    Code:
    The function called at program startup is named main. The implementation declares no
    prototype for this function. It shall be defined with a return type of int and with no
    parameters:
    int main(void) { /* ... */ }
    or with two parameters (referred to here as argc and argv, though any names may be
    used, as they are local to the function in which they are declared):
    int main(int argc, char *argv[]) { /* ... */ }
    or equivalent;9) or in some other implementation-defined manner.
    Well C99 makes it pretty clear that the above definition would fall into "other"... if it was even a valid function signature, which it isn't... when will people learn: int main(void)

  7. #22
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,744
    Well C99 makes it pretty clear that the above definition would fall into "other"... if it was even a valid function signature, which it isn't... when will people learn: int main(void)
    You have forgotten that the void in the parameter list is only necessary for specifying that the function takes no arguments when declaring the function (prototype), not when defining the function. If you claim that C99 does not allow one to leave out the void, then I claim that the C99 standard is inconsistent:
    Code:
    int main()
    {
        size_t size;
        size = fsize3(10); // fsize3 returns 13
        return 0;
    }
    The above program is an example from ISO/IEC 9899:1999 Section 6.5.3.4. If what you say is true, then this is yet another defect in C99, and one that is repeated in the text of the Standard.

    EDIT:
    But of course, even if the void was required, if the author of that article is correct, then I do not see why int main() should not fall under "other", and just be not portable, as cpjust pointed out.
    Last edited by laserlight; 08-18-2008 at 11:13 PM.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

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. Codec Bitrates?
    By gvector1 in forum C# Programming
    Replies: 2
    Last Post: 06-16-2003, 08:39 AM
  3. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 06:57 PM
  4. Drawing a circle in a video captured frame
    By skyhigh in forum C Programming
    Replies: 2
    Last Post: 12-05-2001, 12:00 AM

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