Factorization of some code.

Jeffrey A Law law@cygnus.com
Mon Jan 18 20:39:00 GMT 1999

  In message < 199901182219.XAA28369@mururoa.inria.fr >you write:
  > I'd use -1 instead of 0 as 0 might be a valid parameter (think of -O0 
  > for example (even if I'm not sure that the function 
  > read_integral_parameter can fully apply to the -O switches)).
Fine.  Note that in the case where we get an error, we call "error", maybe we
should call fatal instead.

  > One drawback of having the value returned is that then this value has 
  > to be checked for each call in order to restore some reasonnable 
  > default. This leads to the following style:
That assumes that we want to continue compilation.  I guess we should follow
whatever existing conventions are in place for bogus arguments.

I think passing in a default value is probably a good thing to do -- it makes
it part of the interface -- if something bad happens we call error and return
the default value.

Otherwise it's not particularly clear who has the responsiblity of setting
a default value for non-fatal error cases.


More information about the Gcc-patches mailing list