On Sep 14, 2013, at 8:40 AM, Tom Browder wrote:

>> 7) bu_opt_parse() looks pretty cool.  shouldn't argv be const?  (i.e., char 
>> * const argv[]).  matches getopt signature.
> 
> In order to do that, the caller has to either cast to const or make
> main's signature const which is non-standard as far as I have been
> able to find (although gcc compiles it).

Definitely don't want to change main(), it's not const at that point.  The 
right thing would be to cast, but did you put const on the right pointer?  Note 
that const char *argv[] and const char **argv and char * const argv[] are all 
slightly different and will result in different casting properties.  Trying to 
pass something that is const char ** to something that is char * const[] will 
require a cast.  Casting something that is char *[] to something that is char 
*const[] should not require a cast.

Still, a cast is not the end of the world and it's a good property we should 
specify and leverage where it helps declare immutability.

Cheers!
Sean



------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to