Subject: CGAL users discussion list
List archive
- From: Marc Glisse <>
- To:
- Subject: Re: [cgal-discuss] set_error_handler etc. in header-only mode
- Date: Sun, 8 Dec 2019 10:41:50 +0100 (CET)
On Sat, 7 Dec 2019, Fritz Mueller wrote:
Looking into the sources a bit, get_static_error_handler() etc. are define in
header-only mode as inlines, returning references to local statics. I think
this means each call could conceivably use different storage for those
statics,
No. A static variable inside a function is a unique global object. It is the
usual way to simulate C++17 inline variables and get singletons.
Okay, good to know this is true, even for inlines -- thanks. I can do some
experiments with a small bit of test code to verify that I understand
correctly.
Well, what I’ve found with OS X clang so far is this:
Static variables inside a function are indeed unique if that function is inline, but seeming *not* if that function is static inline? The CGAL functions in question are perhaps effectively static inline because the enclosing anonymous namespace.
Uh, what is that anonymous namespace doing there? It defeats the purpose of the inline functions. It seems that the namespace was there first, used to hide some private stuff but not necessary, and people didn't notice it when they added the header-only mode.
Thanks a lot for the detailed analysis!
If you want to make sure we don't forget to fix it, you can open an issue in cgal's github with this information (or even better open a pull request with a fix), although hopefully it will get fixed soon even without that.
--
Marc Glisse
- [cgal-discuss] set_error_handler etc. in header-only mode, Fritz Mueller, 12/08/2019
- Re: [cgal-discuss] set_error_handler etc. in header-only mode, Marc Glisse, 12/08/2019
- Re: [cgal-discuss] set_error_handler etc. in header-only mode, Fritz Mueller, 12/08/2019
- Re: [cgal-discuss] set_error_handler etc. in header-only mode, Fritz Mueller, 12/08/2019
- Re: [cgal-discuss] set_error_handler etc. in header-only mode, Marc Glisse, 12/08/2019
- Re: [cgal-discuss] set_error_handler etc. in header-only mode, Fritz Mueller, 12/08/2019
- Re: [cgal-discuss] set_error_handler etc. in header-only mode, Marc Glisse, 12/08/2019
- Re: [cgal-discuss] set_error_handler etc. in header-only mode, Fritz Mueller, 12/08/2019
- Re: [cgal-discuss] set_error_handler etc. in header-only mode, Fritz Mueller, 12/08/2019
- Re: [cgal-discuss] set_error_handler etc. in header-only mode, Marc Glisse, 12/08/2019
Archive powered by MHonArc 2.6.18.