DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: main()

  1. #1
    Join Date
    May 2004
    Posts
    242

    main()

    Hello,

    I know that an object of a function goes on the stack and memory allocation takes place from the heap.

    Can someone please tell me where is 'main()' created ?

    Since it's a function, will it go on the heap ? Or, is that special case since it's main() ?

    Thanks.

  2. #2
    Join Date
    Dec 2007
    Posts
    401
    Where code (functions) is stored in memory is an implementation detail.
    This article is fairly representative of the relationship between a compiler, the linker and the loader: http://www.tenouk.com/ModuleW.html

    > Or, is that special case since it's main() ?

    main() is different from all other functions.

    To quote the IS:
    The function main shall not be used within a program. The linkage of main is implementation-defined.
    And:
    Main cannot be called recursively and cannot have its address taken.

Similar Threads

  1. Replies: 5
    Last Post: 12-22-2009, 08:35 AM
  2. Reference main form from a dialog form
    By leebarnard in forum VB Classic
    Replies: 1
    Last Post: 09-27-2006, 01:31 PM
  3. Window Disappears after Sub Main() exits
    By jim12345 in forum .NET
    Replies: 1
    Last Post: 07-26-2006, 01:50 PM
  4. Replies: 5
    Last Post: 02-03-2006, 07:58 PM
  5. problem with main() method
    By Vikas Babbar in forum Java
    Replies: 1
    Last Post: 08-01-2000, 02:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center