home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!crdgw1!rdsunx.crd.ge.com!bart!volpe
- From: volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe)
- Newsgroups: comp.lang.c
- Subject: Multi statement macro (Was: Re: Collection Virus Retract
- Message-ID: <1993Jan21.182528.5470@crd.ge.com>
- Date: 21 Jan 93 18:25:28 GMT
- References: <1993Jan14.214829.119753@marshall.wvnet.edu> <1993Jan20.201726.6015@Newbridge.COM>
- Sender: volpe@bart (Christopher R Volpe)
- Reply-To: volpe@ausable.crd.ge.com
- Organization: GE Corporate Research & Development
- Lines: 65
- Nntp-Posting-Host: bart.crd.ge.com
-
- Lynne-
-
- Subject: Re: Collection Virus Retract
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- What does this subject have to do with your question below?
-
- In article <1993Jan20.201726.6015@Newbridge.COM>, lynnem@Newbridge.COM (Lynne Martin) writes:
- |> In article <1993Jan14.214829.119753@marshall.wvnet.edu> rcbi20@marshall.wvnet.edu writes:
- |> >-- Retraction an my apologies for my previous postings.
- |> >
- |> > I have receive many flames about my Collection of Viruses for Reasreach
- |> >posting and I would like to apologies to all who found my posttings a problem.
- |> >After a long talk with my POSTMASTER I realized how stupid the posting was. I
- |> >would like to thank those who wrote and informed me on the rules of
- |> >internet althought ingorance is no reason to break the rules. I'am very sorry!
- |> >We are going to continue our research but we will not ask for code like I did.
- |> >
- |> >--
- |> > Jason Haught (The Master)
- |> >
- |> >E-Mail Addresses:
- |> >
- |> > RCBI20@Marshall.WVnet.edu (Internet) / RCBI20@Marshall (Bitnet)
- |> > CIS0201@Muvms2.WVnet.edu (Internet)
- |> > @Byrd.MU.WVnet.edu:JHaught@RCBINS.MU.WVnet.edu (Internet)
- |> > Jason@Quayle.MU.WVnet.edu (Internet)
-
- What does the article you included above have to do with your question
- below?
-
- |>
- |> In the Comp.lang.c FAQ, question 6.3 asks what is the best way
- |> to write a multi-statement cpp macro and the answer is:
- |>
- |> #define Func() do {stmt1; stmt2; ... } while (0)
- |>
- |> My problem is that when lint sees one of these macros it spits
- |> out the following warnings:
- |>
- |> warning: constant argument to NOT
- |> warning: constant in conditional context
- |>
- |> Can anyone tell me why lint generates the first warning, and if you've
-
- Well the first warning may be due to the fact that "while(a)" is
- equivalent to "while(!(a==0))", and it may actually be doing a conversion
- internally. So, it sees your condition as "while (!(0==0)). There's
- the argument to the NOT operator.
-
- |> figured out a way to prevent lint from generating either warning?
-
- Preventing the warning is a bit tougher. The warning is correct, from lint's
- point of view. You might have better luck with a different form of the
- multi-statement macro:
-
- #define Func() if (1) {stmt1; stmt2; ...} else
-
- Hope this helps...
-
- -Chris
- --
- ==================
- Chris Volpe
- G.E. Corporate R&D
- volpecr@crd.ge.com
-