Thread: Structure declaration

  1. #16
    Registered User
    Join Date
    Jun 2010
    Posts
    12
    Quote Originally Posted by Bayint Naung View Post
    It should be easy to change STRUCT_ABC to other name in def.c. (probably use script)
    And see whether problem exists.
    I tried that way, and actual issue got resolved.

    But still wanted to figure out the possible reason as to why it works sometimes and not some other time.

  2. #17
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    Since declaration line gives segfault, isn't it probably because of stackoverflow?

  3. #18
    Registered User
    Join Date
    Jun 2010
    Posts
    12
    Quote Originally Posted by Bayint Naung View Post
    Since declaration line gives segfault, isn't it probably because of stackoverflow?
    Theoritically there can't be a stack over flow in my scenario.

    As per my knowledege, structure definition is cross checked and read during compilation, whether it is through header file or else defined inside the C source file.

    Now, can this difference affect the program execution?...me not sure.

    Or else is it something like that compiler stores structure definition of header in some other way, and that of C source in some different way; due to which during runtime it creates conflict??

  4. #19
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    Or else is it something like that compiler stores structure definition of header in some other way, and that of C source in some different way; due to which during runtime it creates conflict??
    There's no difference at all. Putting struct definition in header file is to share struct definition across source files. It's the C pre-processor that include contents of #include to source files.
    Compilation phases

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM