[GRASS-dev] Re: [GRASS GIS] #197: sfd support for r.terraflow

GRASS GIS trac at osgeo.org
Fri Jun 27 21:34:11 EDT 2008


#197: sfd support for r.terraflow
--------------------------+-------------------------------------------------
  Reporter:  adanner      |       Owner:  grass-dev at lists.osgeo.org
      Type:  defect       |      Status:  new                      
  Priority:  major        |   Milestone:  6.4.0                    
 Component:  Raster       |     Version:  svn-develbranch6         
Resolution:               |    Keywords:  terraflow r.terraflow    
  Platform:  Unspecified  |         Cpu:  Unspecified              
--------------------------+-------------------------------------------------
Comment (by glynn):

 Replying to [comment:3 adanner]:

 > > However: is it really necessary for the new file to be in C instead of
 C++? It would simplify matters to keep everything in the same language.
 >
 > Yes, the new file must be in C and not C++. The g++-4.2 throws a warning
 if you try to assign a string constant to a char *. E.g.,

 Sorry; I didn't notice that you had already mentioned that in the original
 report.

 Personally, I wouldn't be especially concerned about the warnings.
 Especially as they are quite legitimate; those fields should really be
 "const char *", as they normally get assigned from string literals.
 Although string literals are treated as "char *", on any platform we care
 about, you will get a segfault if you try to modify them.

 The only fields which are likely to be modified are answer and answers,
 and even that's dubious in terms of clarity. Code should ideally copy the
 values to a separate buffer rather than modifying them in-place.

 Moving the code from C++ to C is simply hiding a legitimate issue. The
 compiled code will be essentially the same regardless of language, and the
 problems are the same. It's just that, for historical reasons, C doesn't
 complain while C++ does.

 My attitude to warnings is to either fix them for real or leave them
 there, with "hiding" them being the worst choice.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/197#comment:4>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list