This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Allow C++ or C99 in sim/*?


On Fri, Aug 01, 2003 at 08:15:52PM -0400, Andrew Cagney wrote:
> Hello,
> 
> Back in '95ish, I adopted ISO C 90 as its programming language for PSIM. 
>  My decision was based on two assumptions: a C++ compiler would be more 
> buggy than C; the C language would be easier for a compiler to optimize 
> than C++; no one in their right mind still used K&R C.  Over time, the 
> ISO C 90 assumption was gradually extended to other simulators (via 
> sim/igen and sim/common) and that led to the sim/ directory requiring 
> ISO C.  This was all well before gdb/ adopted ISO C 90.  History has 
> shown this to be a good decision.
> 
> Now, many years later, I think its time to revisit this:
> 
> Should the simulator directories allow more modern languages?  I can see 
> several options:
> 
> - C99 which would allow C++ comments:
> 	// a comment
> and declarations anywhere:
> 	foo (); int i; bar ()
> and access to int32 et.al. types.  What else?
> 
> - C++ which would also allow access to objects and (ulgh?) templates 
> (replacement for the sim-endian macro stuff?)
> 
> - Oh what the heck, Java and gcj ...
> 
> C99 should be a done deal.  While I hate C++, making GDB developers 

I don't think C99 is a done deal:
  - GCC C99 support is still not finished, though it's mostly there now
    of course.
  - GCC 2.95 is still in wide use, and doesn't allow declarations after
    statements.
  - C99 _libraries_, which are the interesting bit, are very rare.  I
    bet that most of our commercial host platforms aren't all there
    yet.

I also don't see what C99 adds that would be particularly useful to
sim, besides maybe the int32_t etc. types.

> debug C++ code would be a good thing (TM), and there are a few chunks of 

Amen.

> the simulator code that really shouldn't be C.  Java would be, well, 

Also amen.  If it weren't so unlikely to fly, I'd suggest allowing C++
in GDB :) It really would make some things easier.  But requiring a C++
compiler for sim/ at least gives a step in that direction.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]