Checking For X11 Header Files Declarations

  1. Different Header Files

I'm using YouCompleteMe together with the official Syntastic from scrooloose/syntastic. I have confirmed that this issue is present in the most recent version in Github.

  1. I'm trying to compile GAMIT/GLOBK software and there are some prerequisites need. One of them are X11 library (libX11.a, libX11.so, or LibX11.dylib) and X11 header file (Xlib.h). I installed X11 library via 'sudo apt install libX11 -dev' but I cannot find the way to install X11 header file (Xlib.h).
  2. Checking For X11 Header Files Declarations Of War. Pascal, it does not reduce the type safety of Pascal (as many other dialects of Pascal have by including so called. The functionality of the language is similar to that of C# (which implements a C like language but with the type insecurities removed), and Pascaline can be used anywhere that.

X11/Xlibint.h This file declares all the functions, types, and symbols used for extensions, which are described in Extensions. This file automatically includes X11/Xlib.h. X11/Xproto.h This file declares types and symbols for the basic X protocol, for use in implementing extensions.

I have a project set up so that all CPP files containing class declarations have a corresponding H file by the same name, but a different extension. Getting completion in the H files isn't particularly important for me,but when I don't provide the flags for that file, I get 'can't find header..' errors. So I have set up YCM to provide the same flags for the header file as the CPP file.

Different Header Files

However, now that I've provided the flags for the file, not only do I not get proper completions (I get cached completions, but if I type std::, for example, I don't get anything from STL), but I also get flickering every time I'm inserting text into the file.

With

I have narrowed it down to whenever VIM has a changed buffer stored for the .cpp file; if the other file is open but unaltered, no flickering occurs.

edit: I just checked the log files generated in /tmp, and nothing informative seems to be appearing. Just 'initiating buffer for file blah.h', 'initiating buffer for file blah.cpp' and 'completion request for..' nothing else.

I've attached the contents of my .ycm_extra_conf.py file. Let me know if there's anything else I can provide to help you solve this problem.

Regards,
John

Active3 years ago

I've been looking for some clarification for the usage of the using-declarations in header files (I was searching around but couldn't quite get the answer I'm looking for). What I my research concluded so far is, using them in the non-global scope is ok, while namespace directives are bad. That I understood (At least I hope so :)).

So in my example I use shared_ptrs, but I need to support older compilers that do not have them in the std:: namespace but in std::tr1:: for example. Since every class using the shared_ptr needs the same shared_ptr defition, I would have to put the correct #include directive and using declaration in each of these header files. So I moved this part into a seperate header file so I have only one single file where I need to make changes. The decision on which shared_ptr to use, is made via a preprocessor directive HAS_SHAREDPOINTER, which is set if the user has a compiler that supports std::shared_ptr.

SharedPtr.h:

Now in every header file that uses the shared_ptr, I include this header file. For example in

ModelPar.h:

Now I think the way I did it is wrong, since the user that includes any of my header file (using the shared_ptrs) also has the corresponding using declaration in his code. And that's the bad thing, as the user is not aware of this.. etc. So I put my using declarations in the global scope. Or? I'm kind of stuck and confused on how to do this properly? Thanks in advance!

stevesteve

2 Answers

Ok I found 'the' answer myself. I guess that I was not aware that the using declaration in a namespace is still valid in below namespace scopes with the same name. Now Bjarne's words also makes more sense, that one should not pollute the global namespace :). Please correct me though, if I'm still doing something wrong.

SharedPtr.h:

ModelPar.h:

stevesteve

I personally do no see any benefit from having 'using' on any header. Ever.

Not only does it make it extremely hard to re-factor since the compiler errors will become useless if you remove a header header include chain. Getting 300+ errors of missed declarations, types undefined, etc; is not exactly my definition of 'funtimes'.

Sure, you can use some preprocessor magic to to get it done regardless of name collisions. But why? If you have namespace collisions there is problem with your approach, bypass that in that way is as good as turning the fire alarm off and claim there is no fire anymore.

As an extra bonus, it also obscure the ancestry of your class a la 'Was I using FooClass from the X namespace? Or was it from Y?'.

ManuelManuel
Checking for x11 header files declarations in the bible

Not the answer you're looking for? Browse other questions tagged fileheaderdeclarationusing or ask your own question.

Posted on