Thread: comments please...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    9

    comments please...

    Code:
    [/home/kiran/new]@cat > check.c
    main()
    {
    static void f(void);
    f();
    }
    static void f(void)
    {
    printf("sdfgdasj");
    }
    [/home/kiran/new]@gcc check.c
    [/home/kiran/new]@./a.out
    i expect the above code to give compiler error bcos ...there is no point in specifying "static to a void return value"....please explanation

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Quote Originally Posted by kiranck007
    ...there is no point in specifying "static to a void return value"
    I've never heard that one before.
    Sent from my iPadŽ

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    9

    hey

    Quote Originally Posted by SlyMaelstrom
    I've never heard that one before.
    what do u mean.....

  4. #4
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Quote Originally Posted by http://tigcc.ticalc.org/doc/keywords.html
    Code:
    static void PrintCR (void) { putc ('\n'); }
    Quote Originally Posted by http://publications.gbdirect.co.uk/c_book/chapter4/linkage.html
    Code:
    static void fillup(void);
    I think these websites never heard that one either.
    Sent from my iPadŽ

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    static in this context simply means that f() is not visible to any other source file in your program.

    Not so important in a single file program, but when you have lots of files, careful use of static can help a great deal in figuring out the overall structure of a program.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. removing comments of type '//' and '/*'
    By rohit83.ken in forum C++ Programming
    Replies: 3
    Last Post: 10-20-2007, 02:24 AM
  2. removing comments of type '//' and '/*'
    By rohit83.ken in forum C Programming
    Replies: 2
    Last Post: 10-19-2007, 10:14 AM
  3. Comments problem with MSVC 2003
    By mikahell in forum Tech Board
    Replies: 7
    Last Post: 09-04-2006, 06:04 PM
  4. The Art of Writing Comments :: Software Engineering
    By kuphryn in forum C++ Programming
    Replies: 15
    Last Post: 11-23-2002, 05:18 PM
  5. ignoring comments
    By wjday in forum C Programming
    Replies: 11
    Last Post: 04-24-2002, 11:16 AM