Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#116 Improve const-correctness

closed
Ethan Merritt
None
6
2011-03-19
2005-07-24
Markus Elfring
No

Would you like to apply the advices from the article
"http://en.wikipedia.org/wiki/Const_correctness" to
your sources?
I suggest to add the key word "const" to the type
specifiers for parameters like the following examples.
-
http://cvs.sourceforge.net/viewcvs.py/gnuplot/gnuplot/src/command.h?rev=1.37&view=markup
name (function "print_set_output")
s (functions "do_string.*")

-
http://cvs.sourceforge.net/viewcvs.py/gnuplot/gnuplot/src/eval.h?rev=1.21&view=markup
val (function "magnitude", "real", "imag" ...)

Discussion

1 2 3 4 > >> (Page 1 of 4)
  • Logged In: YES
    user_id=27517

    What we would like to do and what can realistically be
    achieved within the given code structure are, unfortunately,
    two different things. const correctness is really something
    that has to be designed into a program from the get-go to be
    manageable. gnuplot is way too old for that to have been
    the case, and the current team IMHO doesn't really have the
    manpower to spare on such issues.

     
  • Markus Elfring
    Markus Elfring
    2005-07-25

    • assigned_to: nobody --> broeker
     
  • Markus Elfring
    Markus Elfring
    2005-07-25

    Logged In: YES
    user_id=572001

    I hope that a const-correct design can be achieved also in
    your software by a refactoring process.

     
  • Markus Elfring
    Markus Elfring
    2005-07-26

    Logged In: YES
    user_id=572001

    Would you like to integrate the appended header files into
    your sources?

     
  • Logged In: YES
    user_id=27517

    No. We can't do anything useful with modified versions of
    outdated header file revisions. If they were diffs to
    current CVS, that might be a different story.

    That set aside, changing header files doesn't fix anything
    yet --- it just renders the source uncompilable because of
    mismatches between prototype and definition.

     
  • Markus Elfring
    Markus Elfring
    2005-07-26

    Logged In: YES
    user_id=572001

    Would any other developer like to copy the suggested changes
    for the 4.0 headers to the current implementation files
    after your general safety checks and review?

     
  • Ethan Merritt
    Ethan Merritt
    2005-07-26

    Logged In: YES
    user_id=235620

    Instead of dumping modified versions of old headers, please
    tackle one or two subroutines at a time. For each set,
    submit a patch (diff -ur format) that updates the prototype
    definition, the subroutine itself, and all the call sites.

    That way there is some hope of testing for correctness of
    the individual pieces. The ones that pass muster can be
    added to cvs. The ones that fail can be sent back for
    further polishing.

     
  • Markus Elfring
    Markus Elfring
    2005-07-27

    • assigned_to: broeker --> sfeam
     
  • Markus Elfring
    Markus Elfring
    2005-07-27

    Logged In: YES
    user_id=572001

    1. Was it published before that only diffs will be accepted
    for further design considerations?

    2. Please confirm the correct path to the sources in the
    repository to avoid that "old" files or obsolete code
    branches will be reviewed.
    http://gnuplot.sourceforge.net/development/ethans_instructions.html

     
  • Ethan Merritt
    Ethan Merritt
    2005-07-27

    Logged In: YES
    user_id=235620

    1. Of course it is not required that you contribute anything
    at all. A suggestion with no code is also welcome. We are
    just saying that if you *do* care to contribute sample code,
    which is very much appreciated!, then it is most useful in
    the form of a "diff -ur" against the current cvs source
    tree. The code has changed sufficiently since version 4.0
    that diffs against earlier versions are unlikely to work.

    2. I don't understand this part of your question. The URL
    you refer to describes how to obtain a copy of the current
    cvs tree, which is what you should work with. But
    SourceForge is down right now so I cannot check to see if
    there is something on that URL that might be confusing.

     
1 2 3 4 > >> (Page 1 of 4)