delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/06/14/16:29:36

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Mon, 14 Jun 2004 16:28:28 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Dave Korn <dk AT artimi DOT com>
cc: cygwin AT cygwin DOT com
Subject: RE: log2 as function not as macro
In-Reply-To: <NUTMEGjbudzxxfYXFrw00000339@NUTMEG.CAM.ARTIMI.COM>
Message-ID: <Pine.GSO.4.58.0406141624460.15743@slinky.cs.nyu.edu>
References: <NUTMEGjbudzxxfYXFrw00000339 AT NUTMEG DOT CAM DOT ARTIMI DOT COM>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Mon, 14 Jun 2004, Dave Korn wrote:

> > -----Original Message-----
> > From: cygwin-owner On Behalf Of Corinna Vinschen
> > Sent: 14 June 2004 14:48
>
> > On Jun 14 14:11, Johnny Willemsen wrote:
> > > Hi,
> > >
> > > Are there plans to deliver log2 as regular function instead of
> > > macro. The log2 as macro is hard to use in projects that also define
> > > a log2 function. I know, we can work around it, but it comes back
> > > and back again.
> >
> > You could ask this on the newlib list, newlib@
>
>   And the answer there will probably be that if your code depends on whether
> this function is a macro or a real function then your code is not valid C.
> The C language spec specifically says that implementations are free to
> provide library functions as macros as well as functions.  See
>
> http://www.opengroup.org/onlinepubs/009695399/basedefs/math.h.html
>
> and in particular the lines that say "The following shall be declared as
> functions and may also be defined as macros. Function prototypes shall be
> provided."
>
>   So if your code has a problem with that, your code does not comply with
> the C language spec.
>
>     cheers,
>       DaveK

Dave,

To be fair, the original poster described the exact problem:
> log2 as macro is hard to use in projects that also define a log2 function.
I'm not sure how your link can be reconciled with this, but at a guess,
projects that define a log2() function are expected to follow "#include
<math.h>" with "#undef log2".
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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