Re: popen()

From: Floyd L. Davidson (floyd_at_barrow.com)
Date: 02/28/04

  • Next message: Thomas Dickey: "Re: Errno.h and EOK constant"
    Date: Sat, 28 Feb 2004 03:25:22 -0900
    
    

    Casper H.S. *** <Casper.***@Sun.COM> wrote:
    >hsiao@ccr.jussieu.fr (Pai-Yi Hsiao) writes:
    >
    >>Hi popen() guru,
    >
    >>How to *correctly* compile a C code containing popen()?
    >>I know that popen() is not an ANSI function.
    >
    >>$gcc -ansi -Wall -pedantic test.c
    >
    >If you know that it's not an ANSI function why are you compiling
    >with "-ansi -pedantic"?

    Probably because whether or not "popen" is an ANSI function is
    virtually unrelated to the reason one would want the compiler to
    assume, even pedantically per gcc, ansi code.

    >The ANSI and POSIX standards have certain rules about identifiers
    >that are defined in standard header files; you can't define any which are
    >not in the standard when compiling in conformant (aka "useless") mode.

    You can define identifiers which are not in the standard when
    compiling in conformant mode (which /is/ a very useful mode),
    and neither the ISO/ANSI nor the POSIX standards claim
    otherwise. (Yes including headers for libraries to which the
    compiler does not have access to the source of does invoke
    undefined behavior and make the program being compiled
    technically nonconformant. Which is itself a complex subject,
    but not really of use to the OP.)

    See the features.h include file. The OP's problem has no direct
    relationship to the ISO/ANSI standard, but rather is an
    implementation detail of gcc and the header files it uses.

    --
    Floyd L. Davidson           <http://web.newsguy.com/floyd_davidson>
    Ukpeagvik (Barrow, Alaska)                         floyd@barrow.com
    

  • Next message: Thomas Dickey: "Re: Errno.h and EOK constant"