cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/12/17:21:17

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Question about #pragma
Date: Tue, 12 Aug 1997 09:03:37 -0700
Organization: Alcyone Systems
Lines: 35
Message-ID: <33F08959.6BFCE741@alcyone.com>
References: <ww01-BHLJZN2260 AT netaddress DOT usa DOT net>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Guan Foo Wah wrote:

> I have seem many source code with the word #pragma. I do not know what
> this means. My C book (Teach Yourself C in 21 Days) did not give me any
> info about this. The only thing I know is it is a preprocessor command.
> 
> Can anyone care to explain to me what is #pragma. Is it ANSI
> compatible ??

#pragma is ANSI, but it is one of those strange standard features that is
included for the sole purposes of allowing implementation-defined
behavior.  From ANSI C, 6.8.6:

    A preprocessing directive of the form

        # pragma pp-tokens_opt new-line

    causes the implmentation to behave in an implementation-defined 
    manner.  Any pragma that is not recognized by the implementation is
    ignored.

The #pragmas that are used from one compiler to another change
drastically, and there's no way to know whether one #pragma will work in
another compiler (because usually it won't).  And, since #pragmas that
aren't recognized are completely ignored, you need to check what the
#pragma did in the last compiler you were using and see if it's important
enough that you'll need to take steps to ensure that you do it with DJGPP.

-- 
       Erik Max Francis, &tSftDotIotE / email / mailto:max AT alcyone DOT com
                     Alcyone Systems /   web / http://www.alcyone.com/max/
San Jose, California, United States /  icbm / 37 20 07 N  121 53 38 W
                                   \
   "Love is not love which alters / when it alteration finds."
                                 / William Shakespeare, _Sonnets_, 116

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019