doubt regarding C structure in linux

This is a discussion on doubt regarding C structure in linux within the C Programming forums, part of the General Programming Boards category; hi everybody! I have doubt regarding C program structure in linux. When I write code on windows platform then I ...

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    104

    doubt regarding C structure in linux

    hi everybody!

    I have doubt regarding C program structure in linux.

    When I write code on windows platform then I have no need to write return type in prototype and it compile and run.....but when I run same code in linux platform them it give compile error which is as follow:

    error: ISO C++ forbids declaration of ‘AAA’ with no type

    whereas AAA is name of function.

    Also there is no need of function prototype in windows but it give error when run on linux.

    Can anybody explain me why this so???

    and also explain me what should I kept in mind before coding in linux...

    thanks in advanced...

    Bargi

  2. #2
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Show us the code.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,546
    > error: ISO C++ forbids declaration of ‘AAA’ with no type
    And you posted on the C forum because?

    Step 1 is decide whether you're programming in C or C++.

    At the moment, you're using a good C++ compiler on Linux, and I guess a really old compiler on windows (not Turbo C surely - bet it is, it seems a popular choice for no good reason)

    > When I write code on windows platform then I have no need to write return type in prototype and it compile and run
    You can get away with this in old C.
    In new C, implicit types are deprecated (meaning you should not do it, but it won't shut the compiler up).
    You could never have implicit types in C++.

    > and also explain me what should I kept in mind before coding in linux...
    Make sure you actually know ANSI C.
    And not the dialect C which you're trying to use at present.

    When you know ANSI C, the issue of "which OS / Compiler" pretty much goes away.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Wireless Network Linux & C Testbed
    By james457 in forum Networking/Device Communication
    Replies: 3
    Last Post: 06-11-2009, 11:03 AM
  2. Replies: 13
    Last Post: 12-14-2007, 02:34 PM
  3. passing structure arrays to functions?
    By bem82 in forum C Programming
    Replies: 3
    Last Post: 10-30-2006, 05:17 AM
  4. Linux Linux why Linux??
    By afreedboy in forum Tech Board
    Replies: 146
    Last Post: 01-21-2004, 05:27 PM
  5. Replies: 3
    Last Post: 10-29-2003, 08:39 AM

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