abc icon indicating copy to clipboard operation
abc copied to clipboard

Negative external variable initialisers don't work

Open davidgiven opened this issue 8 years ago • 1 comments

e.g.

fnord -1;

...produces a syntax error. (Because the CON token only matches positive numbers.)

What I did in my copy was to add a special case in extdef():

https://github.com/davidgiven/ack/commit/8b8910595a4f1652265737a0d8efd931c3e7d201#diff-001711b0da5eb4e0fdb5dd4d0bb2bcfc

davidgiven avatar Jan 07 '17 23:01 davidgiven

Oh, so that's why Alan Snyder's C won't accept a = for initialisation.

int foo1 42;
int foo2 { 42 };
int foo3 = 42;

Error on line 3:

3:  SYNTAX ERROR. PARSE SO FAR:       <program> <decl_specifiers>
<$declarator> _  = 42 ;
4:  SKIPPED:   =

larsbrinkhoff avatar Oct 30 '18 06:10 larsbrinkhoff