stylistic question =) which file should I read first?

This is a discussion on stylistic question =) which file should I read first? within the C++ Programming forums, part of the General Programming Boards category; Hi, say I was commenting on a OOP collection of header and cpp files. which one would I consider my ...

  1. #1
    Registered User
    Join Date
    Jan 2012
    Posts
    14

    stylistic question =) which file should I read first?

    Hi,

    say I was commenting on a OOP collection of header and cpp files.

    which one would I consider my "main" file, the one with "main" in it?

    So, if I was reading someone else's code, would I start by looking for the file with main in it (if it wasn't obvious)? Or, would I start by checking the header files?

    And, say, if I was commenting on a collection of such header/cpp files, would I treat the one with "main" in it, as the main one, or the first header?

    Thanks,

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,002
    There are not good answers to this question.
    main can be anywhere, and it's up the programmer(s) to choose what the file it's in to be called. There may even be multiple mains in different files as long as they're conditionally compiled somehow (such that no two mains end up in the main executable). The only thing you can say is that main is most likely not in a header. I would consider that bad practice.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Jan 2012
    Posts
    14
    Quote Originally Posted by Elysia View Post
    There are not good answers to this question.
    main can be anywhere, and it's up the programmer(s) to choose what the file it's in to be called. There may even be multiple mains in different files as long as they're conditionally compiled somehow (such that no two mains end up in the main executable). The only thing you can say is that main is most likely not in a header. I would consider that bad practice.
    cool. thanks for the quick response.

    Will just have to navigate my way through, via trial and error, and see how the winds blow =)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question in read file
    By leandrogsousa in forum C Programming
    Replies: 1
    Last Post: 07-11-2010, 10:42 AM
  2. [question] ifstream read file, thanks!
    By userpingz in forum C++ Programming
    Replies: 6
    Last Post: 05-19-2009, 07:38 PM
  3. How should I read this file (i/o question)
    By mmattax in forum C Programming
    Replies: 13
    Last Post: 01-17-2006, 11:16 AM
  4. Replies: 3
    Last Post: 03-05-2005, 04:03 AM
  5. Yet another read file question ...
    By Unregistered in forum Windows Programming
    Replies: 2
    Last Post: 02-28-2002, 11:00 PM

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