[antlr-interest] C runtime, VS2005 barfs at generated Initializers for double!!
Jim Idle
jimi at temporal-wave.com
Fri Nov 14 10:34:04 PST 2008
On Fri, 2008-11-14 at 10:23 -0800, Vamsi Juvvi wrote:
> I just checked. Extensions are turned on in my C++/Language options.
> If I turn them off, I get a boatload of errors in windows headers
> themselves. So VS2005 doesn't handle this even with Extensions turned
> on.
>
> Is there some other extension that needs to be turned on ? I just
> used the default options when I created a new sln.
>
> thanks for looking into this.
>
I guess that it is just something that VS2005 did not support in C code.
However, there is probably no need for me to use this extension when
initializing with 0 anyway. I will take it off and see what happens. I
am sure I must have deliberately put it there though at some time - I
will check perforce :-(
Jim
> -vamsi
>
>
> On Thu, Nov 13, 2008 at 4:02 PM, Jim Idle <jimi at temporal-wave.com>
> wrote:
>
> On Thu, 2008-11-13 at 15:28 -0800, Jim Idle wrote:
> > On Wed, 2008-11-12 at 19:57 -0800, Vamsi Juvvi wrote:
> > > Hi list/the-not-so-idle-idle:
> > >
>
>
>
> Just a thought here though - have you done something like turn
> off
> extensions in your project? I don't have VS2005 loaded anymore
> so can't
> try this easilly.
>
> Jim
>
>
>
> > > While preparing a small antlr presentation for my
> colleagues I
> > > managed to generate code that VS 2005 simply refuses to
> compile.
> > >
> > > in my tree parser for a simple calculator example. I
> have
> > >
> > > atom returns [double val]
> > > : (
> > > a=DECIMAL_LITERAL
> > > | a=HEX_LITERAL
> > > | a=OCTAL_LITERAL
> > > )
> > > { val = parseInt($a.text);}
> > >
> > > | a=FLOATING_POINT_LITERAL
> > > {val = parseDouble($a.text);}
> > > ;
> > >
> > > The generated code for the atom method does this to
> initialize val
> > >
> > > double val = 0.0D;
> > >
> > > It does not compile unless I remove the D suffix on the
> 0.0. 0.0D is
> > > not a legal double literal for Visual studio C/C++.
> >
> > Works fine with VS2008. Perhaps your best bet is to compile
> with
> > the .Net C compiler.
> >
> > > Is there any way I can turn this automatic initialization
> off ? Or is
> > > this a bug that'll need to be fixed in the C templates ? I
> can
> > > workaround this using a struct to wrap my double but that
> would be
> > > perverse.
> >
> > It is auto-intialized in the templates. However, I suspect
> that I
> > probably changed it to use D for C++ or some other compiler.
> I will have
> > to retest it all to change that.
> >
> > Jim
> >
> > >
> > > thanks much for reading.
> > >
> > > -vamsi
> > >
> > > --
> > > Between impulse and reaction lies man's greatest strength:
> The freedom
> > > to create a choice, to create his universe, to choose -
> Victor Frankl
> > > (adapted)
> > > List:
> http://www.antlr.org/mailman/listinfo/antlr-interest
> > > Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> > >
> >
> >
> > List:
> http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> >
>
>
>
>
>
>
> --
> Between impulse and reaction lies man's greatest strength: The freedom
> to create a choice, to create his universe, to choose - Victor Frankl
> (adapted)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081114/d3bfd0b8/attachment.html
More information about the antlr-interest
mailing list