STR #1808

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 2.0 | Post Text | Post File | SVN ⇄ GIT ]

STR #1808

Application:FLTK Library
Status:5 - New
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:3 - Applies to all machines and operating systems
Subsystem:Unassigned
Summary:FLTK2's fluid does respect namespaces correctly
Version:2.0-current
Created By:gga
Assigned To:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]

No files


Trouble Report Comments:

Post Text ]
Name/Time/Date Text top right image
 
#1 gga
19:50 Oct 11, 2007
When you create a namespace inside your .fl definition, FLTK2's fluid will create a cxx file that clearly does not respect the namespace correctly.

Instead of doing a:

namespace XXX {
   ...widgets...
   ...functions...
}

and adding all widgets and functions inside the namespace, fltk2's fluid creates a .cxx file that does:

using namespace XXX;
...widgets...
...functions...

While this amazingly compiles, it is SO wrong that I have no words to begin to describe it.  By Doing this FLTK is flattening the namespace which can lead to all sorts of weird name clashes.
 
 
#2 greg.ercolano
20:27 Oct 11, 2007
Ya, I don't think fluid is aware of certain C++ coding styles.

As a workaround for the short term, you might try making
two #include files, the first with the 'using namespace xxx {'
and the other with the '}'.
 
 
#3 fabien
03:57 Mar 20, 2008
As we said many, many times, fluid does NOT and will NOT implement all the c++ coding styles, instead, it tries to help solving 'basic' c++ issues.
This (limited) namespace capability was mainly developped to support the fltk namespace and thus making our own libs code more orthogonal with the  fltk coding standards, if any.
This said, I could not care less if the coding standards that we use are ugly to you. If you have some better code implementation to show us in fluid : please do, I will review it personally, otherwise we all do that for free and must spend time for our paid activities too.
 
 
#4 bahri.gencsoy
14:59 Jul 02, 2009
The same problem avoids mingw to compile the generated code. I guess the solution is not that hard, here is my patch for FunctionType.cxx:

I couldn't get Eclipse's SVN working properly, there may be some errors with the format of this patch. Basically, I changed NamespaceType::write_static method, and appended a new at the end of code (in write_code method).

Index: FunctionType.cxx
===================================================================
--- FunctionType.cxx (revision ?)
@@ -1039,16 +1039,17 @@
 }
 
 void NamespaceType::write_static() {
-    write_c("using namespace %s;\n",get_full_string());
+ write_c("namespace %s\n{",get_full_string());
 }
 void NamespaceType::write_code() {
     parent_namespace = current_namespace;
     current_namespace = this;
     write_h("\nnamespace %s ", name());
     write_h("%s", get_opening_brace(1));
     for (FluidType* q = first_child; q; q = q->next_brother) q->write_code();
     write_h("}\n");
+    write_c("}\n");
     current_namespace = parent_namespace;
 }
 
 
#5 bahri.gencsoy
15:05 Jul 02, 2009
The patch I posted above is not complete thus not correct, it doesn't work for inner namespaces.  
bottom left image   bottom right image

Return to Bugs & Features | Post Text | Post File ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.