Menu

#5776 Remove redundant checks with C++11

Fixed
Enhancement
2020-02-25
2020-02-20
No

Remove redundant checks with C++11

Individual changes:
1) Drop check for std::vector::data()

The corresponding code was already removed in 2015, commit d36ec1303b
("Issue 4577: Remove the nasty workaround for platforms that don't
provide std::vector::data().").

2) flower: Rely on [v]snprintf from libc

These are required in C++11 according to
https://en.cppreference.com/w/cpp/io/c/fprintf
https://en.cppreference.com/w/cpp/io/c/vfprintf

While editing config.hh.in, also get rid of unused HAVE_LRINT.

3) Drop check for explicit template instantiation

The define was unused and as far as I can tell, the code is valid
C++ and should just always work.

http://codereview.appspot.com/583550043

Discussion

  • David Kastrup

    David Kastrup - 2020-02-20

    3) Drop check for explicit template instantiation

    The define was unused and as far as I can tell, the code is valid
    C++ and should just always work.

    One thing that I have mused about at times is the separation of files
    flower/include/interval.tcc
    lily/include/smobs.tcc
    that makes sense for implementations with a template repository approach (something that was considered/implemented in early C++ implementations but has been outmoded long ago).

    Maybe those should just get folded into their respective include files? If so, at the bottom, or dispersed logically?

    Not necessarily as part of this patch. Just something that might make sense at some point of time.

     
    • Jonas Hahnfeld

      Jonas Hahnfeld - 2020-02-20

      One could argue that it still makes sense to kind of separate the declaration from the template implementation. I don't have a strong opinion here.

      [FWIW and totally unrelated to this issue (well, that's what I muse about): I tried to reduce the amount of templates in smobs.tcc at least twice. That would be nice because I think it would be one of the easiest gains to reduce compile time - right now, every TU instantiates some tens of Smob_base<T> and the duplicated code is only dropped at the link stage, the duplicated debug information probably never. Unfortunately I failed so far because the code extensively uses static functions, something that cannot easily be replaced by polymorphism as I would do in an object-oriented language.]

       
  • Anonymous

    Anonymous - 2020-02-21
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> review
     
  • Anonymous

    Anonymous - 2020-02-21

    Passes make, make check and a full make doc.

     
  • Anonymous

    Anonymous - 2020-02-22
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2020-02-22

    Patch on countdown for Feb 24th

     
  • Anonymous

    Anonymous - 2020-02-24
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2020-02-24

    Patch counted down - please push

     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2020-02-25

    pushed to staging as

    commit 350da6659902d38fc305c0b25c9e7659f8108563
    Author:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    AuthorDate: Thu Feb 20 12:27:29 2020 +0100
    Commit:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    CommitDate: Tue Feb 25 09:58:13 2020 +0100
    
        Issue 5776/3: Drop check for explicit template instantiation
    
        The define was unused and as far as I can tell, the code is valid
        C++ and should just always work.
    
    commit 8a1ebfb93100ecda500016bb2f3e328b8add3b54
    Author:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    AuthorDate: Sun Feb 16 11:15:59 2020 +0100
    Commit:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    CommitDate: Tue Feb 25 09:58:09 2020 +0100
    
        Issue 5776/2: flower: Rely on [v]snprintf from libc
    
        These are required in C++11 according to
        https://en.cppreference.com/w/cpp/io/c/fprintf
        https://en.cppreference.com/w/cpp/io/c/vfprintf
    
        While editing config.hh.in, also get rid of unused HAVE_LRINT.
    
    commit b51e6224ab6bf888edb68e45dd6f7a128c4d12a6
    Author:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    AuthorDate: Sun Feb 16 11:09:15 2020 +0100
    Commit:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    CommitDate: Tue Feb 25 09:58:03 2020 +0100
    
        Issue 5776/1: Drop check for std::vector::data()
    
        The corresponding code was already removed in 2015, commit d36ec1303b
        ("Issue 4577: Remove the nasty workaround for platforms that don't
        provide std::vector::data().").
    
     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2020-02-25
    • labels: --> Fixed_2_21_0
    • status: Started --> Fixed
    • Patch: push -->