Subject: Re: bin/36444: flex generates bad C++ code
To: Michael van Elst <mlelstv@serpens.de>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 06/05/2007 11:32:57
On Jun 5,  5:17pm, mlelstv@serpens.de (Michael van Elst) wrote:
-- Subject: Re: bin/36444: flex generates bad C++ code

| On Tue, Jun 05, 2007 at 03:00:14PM +0000, Christos Zoulas wrote:
| >  The problem should be fixed by changing:
| >   	unsigned long size;
| 
| This can't be changed, but you can cast the value to yy_size_t
| when passing it to yy_scan_bytes.
| 
| >  We could add a few more yy_scan_bytes() functions so that we have explicit
| >  matches for unsigned long and long, but it is not worth the trouble. Passing
| >  a long where an int is expected is not a good practice anyway.
| 
| What problem is this function overloading trying to solve?

I forget the exact problem, but it had something to do with buffers being
yy_size_t internally where some of the flex API's used int to pass values
to them. This caused problems to another application. I did not want to
cause an ABI change by s/int/yy_size_t/, so I added the overloading in c++.
This has not caused a problem until now (when someone passed an unsigned
long to a function and the overloading could not resolve it).

christos