On 30.05.2011, at 17:10, Albrecht Schlosser wrote: > On 30.05.2011 15:39, MacArthur, Ian (SELEX GALILEO, UK) wrote: > >> OK: I'm pretty sure that threads.h is the culprit here - it explicitly >> #includes several system header files from inside the namespace fltk3 >> {...} and that seems to be the issue. >> >> Moving those #include out of the namespace{} and all seems to compile >> just fine... > > Yep, that works. > Congratulation, you're now a fltk3 developer! ;-) > > But... why should all this thread stuff be in the fltk3 namespace > at all? I *removed* all that fltk3 namespace stuff from threads.h, > and here is my patch (some lines may wrap):
Well, noe you functions are in the global namespace and may collide with other names elsewhere in your program. The namespace idea is to securely separate external library code from the main code. BTW: I am not a huge fan of namespaces, but I can see their use. They really do avoid name collisions, especially if a library apis offers function names like "w()" to get the screen width. Fl::w(), or fltk::w() or fltk3:w() is very unique. What's useless is the command namespace fltk3; because it lifts hundreds of functions into the global namespace and collisions will happen! Very useful though is namespace fl = fltk3; which reduces typing: fl::Window *w = new fl::Window(1, 2, 3, 4, ...); ... _______________________________________________ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev