Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve codebase with modern C++ #2320

Closed
egorpugin opened this issue Mar 14, 2019 · 5 comments
Closed

Improve codebase with modern C++ #2320

egorpugin opened this issue Mar 14, 2019 · 5 comments

Comments

@egorpugin
Copy link
Contributor

egorpugin commented Mar 14, 2019

Assuming we have minimal C++14 (or 17?), there's a worthy task to improve tesseract codebase.
C++14 is on by default since g++-6, clang-5 (or 6), msvc since VS2015? (VS2019 release is on April 2).

This is not immediate task, so we could do this over time slowly.

  1. Update complex types (iterators etc.) with auto keyword.
    https://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-always-auto/
    https://steveire.wordpress.com/2016/03/19/aaargh-aaa-right-good-and-hygenic/
    4c2bbeb#comments (for reference).

  2. Start using range-for loops.
    631882a#r32894610 (for reference).

@amitdo
Copy link
Collaborator

amitdo commented Mar 14, 2019

egorpugin referenced this issue Mar 25, 2019
clang warnings:

    src/ccutil/unicharcompress.cpp:172:27: warning: comparison of integers of different signs: 'int' and 'std::__cxx1998::vector::size_type' (aka 'unsigned long') [-Wsign-compare]
    src/lstm/recodebeam.cpp:129:29: warning: comparison of integers of different signs: 'std::__cxx1998::vector::size_type' (aka 'unsigned long') and 'int' [-Wsign-compare]
    src/lstm/recodebeam.cpp:276:48: warning: comparison of integers of different signs: 'std::__cxx1998::vector::size_type' (aka 'unsigned long') and 'int' [-Wsign-compare]
    unittest/imagedata_test.cc:101:21: warning: comparison of integers of different signs: 'int' and 'std::__cxx1998::vector::size_type' (aka 'unsigned long') [-Wsign-compare]
    unittest/linlsq_test.cc:33:23: warning: comparison of integers of different signs: 'int' and 'std::__cxx1998::vector::size_type' (aka 'unsigned long') [-Wsign-compare]
    unittest/linlsq_test.cc:44:23: warning: comparison of integers of different signs: 'int' and 'std::__cxx1998::vector::size_type' (aka 'unsigned long') [-Wsign-compare]
    unittest/nthitem_test.cc:27:23: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
    unittest/nthitem_test.cc:68:21: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
    unittest/stats_test.cc:26:23: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Signed-off-by: Stefan Weil <[email protected]>
@egorpugin
Copy link
Contributor Author

  1. Range for loops (first post updated).

@amitdo
Copy link
Collaborator

amitdo commented Mar 25, 2019

@zdenop
Copy link
Contributor

zdenop commented Jun 24, 2019

I do not think we need to keep open issue for this. Better would be to send PR or create separate branch to be safe: at the moment we have wide range of OS/devices supported (mobile, BDS, linux, Windows Mac, Rasbery PI...) and would prefer to keep support until it make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants