very strange gcc output

Discussion in 'C Programming' started by Miroslaw Osys, Sep 7, 2003.

  1. Hello everyone!

    I am using C for almost 10 years and recently was very surprised.

    Under Slackware Linux 8.1 and gcc 2.95.3 I tried to compile program
    which simpler version is

    ----- test.c --------------
    #include <termios.h>

    int B0;
    ---------------------------

    tried with
    gcc -c test.c
    and got
    test.c:3: parse error before `0000000'

    File termios.h seems not to define B0.
    Could you explain me this behaviour, please?

    Regards
    Miroslaw Osys
    Miroslaw Osys, Sep 7, 2003
    #1
    1. Advertising

  2. Miroslaw Osys <> scribbled the following:
    > Hello everyone!


    > I am using C for almost 10 years and recently was very surprised.


    > Under Slackware Linux 8.1 and gcc 2.95.3 I tried to compile program
    > which simpler version is


    > ----- test.c --------------
    > #include <termios.h>


    > int B0;
    > ---------------------------


    > tried with
    > gcc -c test.c
    > and got
    > test.c:3: parse error before `0000000'


    > File termios.h seems not to define B0.
    > Could you explain me this behaviour, please?


    termios.h does not define B0, but bits/termios.h, included indirectly
    by termios.h, does. This was found by a very simple grep operation after
    a preprocess-only invocation of gcc on your code.

    --
    /-- Joona Palaste () ---------------------------\
    | Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
    | http://www.helsinki.fi/~palaste W++ B OP+ |
    \----------------------------------------- Finland rules! ------------/
    "C++. C++ run. Run, ++, run."
    - JIPsoft
    Joona I Palaste, Sep 7, 2003
    #2
    1. Advertising

  3. In 'comp.lang.c', Miroslaw Osys <> wrote:

    > I am using C for almost 10 years and recently was very surprised.
    >
    > Under Slackware Linux 8.1 and gcc 2.95.3 I tried to compile program
    > which simpler version is
    >
    > ----- test.c --------------
    > #include <termios.h>
    >
    > int B0;
    > ---------------------------
    >
    > tried with
    > gcc -c test.c
    > and got
    > test.c:3: parse error before `0000000'
    >
    > File termios.h seems not to define B0.


    but some include header could, or B0 could be some gcc build-in extension,
    who knows...

    Try again with

    gcc -c -ansi -pedantic -W -Wall -O3 test.c

    > Could you explain me this behaviour, please?


    <termios.h> is not a standard header. Pedants say that including a non
    standard header invokes an undefined behaviour. I'm close to think there are
    right.

    Please repost to a Linux newsgroup if your concern is <termios.h>.

    --
    -ed- [remove YOURBRA before answering me]
    The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
    <blank line>
    FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
    Emmanuel Delahaye, Sep 7, 2003
    #3
  4. Hi again!

    Thank for responses. It is a pity I cannot use B0 identifier even as
    field name...
    Probably solution is to move everything related to termios.h to separate
    file.

    Regards
    Miroslaw Osys
    Miroslaw Osys, Sep 7, 2003
    #4
  5. In 'comp.lang.c', Miroslaw Osys <> wrote:

    > Thank for responses. It is a pity I cannot use B0 identifier even as
    > field name...
    > Probably solution is to move everything related to termios.h to separate
    > file.


    Absolutely. It's called modular programming, and it's a Good Thing.

    --
    -ed- [remove YOURBRA before answering me]
    The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
    <blank line>
    FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
    Emmanuel Delahaye, Sep 7, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raymond Arthur St. Marie II of III

    very Very VERY dumb Question About The new Set( ) 's

    Raymond Arthur St. Marie II of III, Jul 23, 2003, in forum: Python
    Replies:
    4
    Views:
    448
    Raymond Hettinger
    Jul 27, 2003
  2. shanx__=|;-

    very very very long integer

    shanx__=|;-, Oct 16, 2004, in forum: C Programming
    Replies:
    19
    Views:
    1,589
    Merrill & Michele
    Oct 19, 2004
  3. Abhishek Jha

    very very very long integer

    Abhishek Jha, Oct 16, 2004, in forum: C Programming
    Replies:
    4
    Views:
    407
    jacob navia
    Oct 17, 2004
  4. Peter

    Very very very basic question

    Peter, Feb 8, 2005, in forum: C Programming
    Replies:
    14
    Views:
    495
    Dave Thompson
    Feb 14, 2005
  5. olivier.melcher

    Help running a very very very simple code

    olivier.melcher, May 12, 2008, in forum: Java
    Replies:
    8
    Views:
    2,244
Loading...

Share This Page