pfalcon / re1.5

re1, the unbloated regexp engine by Russ Cox, elaborated to be useful for real-world applications
BSD 3-Clause "New" or "Revised" License
42 stars 4 forks source link

main: Disable including old unmaintained code with -DDEBUG. Add flags. #13

Closed ampli closed 9 years ago

ampli commented 9 years ago

The old debug code is now under ODEBUG, which is for old for documenting what used to be the old debug code. The variables that are related to it, previously caused warning of unused variables on a non-DEBUG compilation, also got moved under the the said ODEBUG.

I think this old debug code can now even be removed from main.c.

pfalcon commented 9 years ago

Merged and even pushed, just to find out that:

main.c:46:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (char *arg = &argv[0][1]; *arg; arg++) {

We should stay C89 compatible (fixed).

ampli commented 9 years ago

I was under the impression that c99 is extensively being used in this and the MictoPython project.

  1. The code is full of // comments, which are not recognized in c89 mode.
  2. The code also uses declarations after statement, a feature which is also not valid in c89.
  3. MicroPython also uses c99 struct field initialization...

So why ban only this specific c99 construct?

pfalcon commented 9 years ago

I was under the impression that c99 is extensively being used in this and the MictoPython project.

uPy yes, but for re1.5, it makes sense to stay more conservative to not narrow project base in which it can be used (again, I don't maintain re1.5 only for uPy, but for other projects which may find it useful).

So why ban only this specific c99 construct?

Dunno, that's what standard gcc (4.8.4) of ubuntu 14.04 errored out on ;-). It apparently uses "gnu89" mode by default which allows many things from c99.