Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!cs326ag From: cs326ag@ux1.cso.uiuc.edu (Loren J. Rittle) Newsgroups: comp.sys.amiga.advocacy Subject: Re: A change to the C++ standard Message-ID: <1991Apr5.212512.27615@ux1.cso.uiuc.edu> Date: 5 Apr 91 21:25:12 GMT Organization: University of Illinois at Urbana Lines: 42 In article <2264@winnie.fit.edu> rcs91900@zach.fit.edu ( Charles Stockman /ADVISOR-Clutterham) writes: >I am writing a C++ compiler and have one quick question > >In C/C++ Octal is defined as > > 012 (octal) --> 10 (decimal) > >Instead of starting octals off with a 0 I am planning to start them of with >0o > > 0o12 (octal) --> 10 (decimal) > >The reason is that I want to make it easier to build the scanner. By using >0o all I would have to do is check for 0o and surely know if it was an >octal or not. In the Ansi standard either an octal or a floating digit >may start with a 0 so it would take longer to decide if it was an octal or >floating point and the code would not be as clean. Unless you are designing an ad hoc scanner (i.e. you aren't using Lex and Yacc/Bison), the above is not true. If you *are* designing an ad hoc scanner, then I say you're crazy :-). Even if you are designing an ad hac scanner (you're still crazy), if it starts with 0[^.] then you know it is octal. Scanning for 0[^.] should be of the same complexity as scanning for 0o. In any event, I would not deviate from the standard... Put it is your project and you can take any short cuts you want... > 045 --> octal > 0.3 --> floating point > >Well --> What do you think, should I change it or keep it the same ? In sum, keep it the same. Loren J. Rittle -- ``NewTek stated that the Toaster *would* *not* be made to directly support the Mac, at this point Sculley stormed out of the booth...'' --- A scene at the recent MacExpo. Gee, you wouldn't think that an Apple Exec would be so worried about one little Amiga device... Loren J. Rittle l-rittle@uiuc.edu