Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #5442

Re: offsetof() Macro Attempt

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!postnews.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Sat, 04 Jun 2011 13:56:41 -0500
Message-ID <4DEA7FEE.5C72@mindspring.com> (permalink)
Date Sat, 04 Jun 2011 14:56:46 -0400
From pete <pfiland@mindspring.com>
Reply-To pfiland@mindspring.com
Organization PF
X-Mailer Mozilla 3.04Gold (WinNT; I)
MIME-Version 1.0
Newsgroups comp.lang.c
Subject Re: offsetof() Macro Attempt
References <isb79p$oao$1@dont-email.me> <4DE92C83.824@mindspring.com> <iscl9q$dgc$1@dont-email.me> <4DEA0DB0.5BE6@mindspring.com> <isdfme$kvf$1@dont-email.me> <4DEA636F.7BF2@mindspring.com> <isdpom$i0p$1@dont-email.me>
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Lines 77
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 4.154.216.167
X-Trace sv3-Nu6+iuZfUPVDtiqgqwk1jdHFWhDjIxNjlbCIExrBaGVhgwYiet38F/QvgCvAd5o9m+7Mk4/7vf82ZKg!4mk0x3Vfo7jiseXLU9VrWhyqLmYPb7M+iv3TJwxzNESKcbEwEmsFNkvUFuot92SZGBq8dWSFrdRJ!QDAqimyp5CI=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 3006
Xref x330-a1.tempe.blueboxinc.net comp.lang.c:5442

Show key headers only | View raw


Shao Miller wrote:
> 
> On 6/4/2011 11:55 AM, pete wrote:
> > Shao Miller wrote:
> >>
> >> On 6/4/2011 5:49 AM, pete wrote:
> >>> Shao Miller wrote:
> >>>>
> >>>> On 6/3/2011 1:48 PM, pete wrote:
> >>>>> Shao Miller wrote:
> >>>>>
> >>>>>> So let's please go on to:
> >>>>>>
> >>>>>>       char ** helper;
> >>>>>>
> >>>>>>       enum foo {
> >>>>>>           bar = *helper + 1 - *helper
> >>>>>>         };
> >>>>>>
> >>>>>>       int main(void) {
> >>>>>>           return 0;
> >>>>>>         }
> >
> >>> But even if (*helper) was defined,
> >>> then (*helper + 1 - *helper) is still not a constant expression
> >
> > I should have said 'not an "integral constant expression"'
> >
> 
> Ok.  I took that as your intended meaning, actually.
> 
> >>> and the compiler that I'm using,
> >>> won't compile the above program.
> >>>
> >>
> >> May I ask which compiler, please?  Since I am concerned about
> >> portability, that'd be great to know.  Thanks!
> >
> > One of the ancient ones.
> >
> > Microsoft Developer Studio 97
> > VC++ 5.0
> >
> > Compiling...
> > new.c
> > C:\Program Files\DevStudio\SharedIDE\bin\new.c(5) : error C2057:
> > expected constant expression
> > Error executing cl.exe.
> >
> > new.obj - 1 error(s), 0 warning(s)
> >
> 
> Do you suppose it's compiling according to some C Standard, or is it
> compiling as C++?

It's Microsoft's 1997 attempt at C89.
It compiles as c++ only when the file name is *.cpp

> Also, if it's not a complete waste of your time, how does it react to:
> 
>    int x;
> 
>    enum foo {
>        bar = 1 ? 3 : x - x
>      };
> 
>    int main(void) {
>        return 0;
>      }
> 
> ?

The compiler likes that one.
If the (1) is replaced with a zero, then it doesn't like it.

-- 
pete

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

offsetof() Macro Attempt Shao Miller <sha0.miller@gmail.com> - 2011-06-03 13:57 -0400
  Re: offsetof() Macro Attempt Billy Mays <noway@nohow.com> - 2011-06-03 13:59 -0400
    Re: offsetof() Macro Attempt Shao Miller <sha0.miller@gmail.com> - 2011-06-03 14:33 -0400
      Re: offsetof() Macro Attempt Noob <root@127.0.0.1> - 2011-06-08 15:03 +0200
  Re: offsetof() Macro Attempt pete <pfiland@mindspring.com> - 2011-06-03 14:48 -0400
    Re: offsetof() Macro Attempt Shao Miller <sha0.miller@gmail.com> - 2011-06-04 02:02 -0500
      Re: offsetof() Macro Attempt pete <pfiland@mindspring.com> - 2011-06-04 06:49 -0400
        Re: offsetof() Macro Attempt Shao Miller <sha0.miller@gmail.com> - 2011-06-04 09:32 -0500
          Re: offsetof() Macro Attempt pete <pfiland@mindspring.com> - 2011-06-04 12:55 -0400
            Re: offsetof() Macro Attempt Shao Miller <sha0.miller@gmail.com> - 2011-06-04 13:24 -0500
              Re: offsetof() Macro Attempt pete <pfiland@mindspring.com> - 2011-06-04 14:56 -0400
                Re: offsetof() Macro Attempt pete <pfiland@mindspring.com> - 2011-06-04 15:38 -0400
                Re: offsetof() Macro Attempt Shao Miller <sha0.miller@gmail.com> - 2011-06-04 18:25 -0500
                Re: offsetof() Macro Attempt pete <pfiland@mindspring.com> - 2011-06-05 07:10 -0400
  Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-03 13:39 -0700
    Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-03 19:58 -0700
      Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-04 01:57 -0700
        Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-04 05:22 -0700
          Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-04 10:16 -0700
            Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-04 23:03 -0700
              Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-05 02:24 -0700
                Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-06 08:08 -0700
                Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-06 13:26 -0700
                Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-08 12:34 -0700
                Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-08 15:07 -0700
                Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-08 15:19 -0700
                Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-14 14:53 -0700
                Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-14 14:52 -0700
                Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-14 16:24 -0700
                Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-15 06:44 -0700
                Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-15 10:40 -0700
                Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-19 13:48 -0700
                Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-19 14:57 -0700
                Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-23 00:52 -0700
                Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-23 12:34 -0700
                Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-27 10:03 -0700
                Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-07-01 10:03 -0700
                Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-07-03 14:33 -0700
                Re: offsetof() Macro Attempt Michael Press <rubrum@pacbell.net> - 2011-06-18 21:17 -0700
                Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-27 10:13 -0700
    Re: offsetof() Macro Attempt Shao Miller <sha0.miller@gmail.com> - 2011-06-04 14:05 -0500
      Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-05 02:44 -0700
        Re: offsetof() Macro Attempt Shao Miller <sha0.miller@gmail.com> - 2011-06-06 17:58 -0500
          Re: offsetof() Macro Attempt Harald van Dijk <truedfx@gmail.com> - 2011-06-06 15:37 -0700
            Re: offsetof() Macro Attempt Shao Miller <sha0.miller@gmail.com> - 2011-06-06 18:58 -0500
  Re: offsetof() Macro Attempt Andrey Tarasevich <andreytarasevich@hotmail.com> - 2011-06-03 17:15 -0700
    Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-03 20:20 -0700
    Re: offsetof() Macro Attempt Shao Miller <sha0.miller@gmail.com> - 2011-06-04 12:50 -0500
  Re: offsetof() Macro Attempt Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-03 21:43 -0400
    Re: offsetof() Macro Attempt Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-03 21:54 -0400
      Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-03 20:36 -0700
  Re: offsetof() Macro Attempt Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-03 19:46 -0700

csiph-web