From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,9e499c74312ed3f0 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-05-21 00:50:04 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!fr.usenet-edu.net!usenet-edu.net!oleane.net!oleane!nnrp.oleane.net!not-for-mail From: "Jean-Pierre Rosen" Newsgroups: comp.lang.ada Subject: Re: Static assertions Date: Mon, 21 May 2001 09:50:50 +0200 Organization: Adalog Message-ID: <9eahad$6ks$1@s1.read.news.oleane.net> References: <9e0pfb$ao9$1@s1.read.news.oleane.net> NNTP-Posting-Host: mailhost.axlog.fr X-Trace: s1.read.news.oleane.net 990431374 6812 195.25.228.57 (21 May 2001 07:49:34 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Mon, 21 May 2001 07:49:34 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:7669 Date: 2001-05-21T09:50:50+02:00 List-Id: "Aaro Koskinen" a �crit dans le message news: pdx7kzd3fdb.fsf@sirppi.helsinki.fi... > "Jean-Pierre Rosen" writes: > > Still discovering how powerful Ada is... > > > > Imagine your program relies on Integer having a certain size, or being sure > > that the size of Integer is four times the size of character, or things like > > that, and you want to make sure that the program does not even compile if > > the assertions do not hold (because you hate fighting with a debugger). This > > is possible, since a static expression that raises constraint_error will not > > compile. > > I have been using a similar method in C. I have an assert macro, which > declares a const int with the value "1 / ". > If the assertion does not hold, it evaluates to 0, and the code will > not compile. > Out of curiosity... Is this *required* by the C standard ? -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr