:: Re: [DNG] [DN Offlist G] netman GIT…
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: KatolaZ
Fecha:  
A: Steve Litt
Cc: dng
Asunto: Re: [DNG] [DN Offlist G] netman GIT project
On Mon, Sep 14, 2015 at 10:28:09AM -0400, Steve Litt wrote:

[cut]

>
> KatolaZ,
>
> Back in the day I used to do #include "/path/absolute" all the time.
> I'm pretty sure #include #include "../path/relative" would work too.
>
> I prefer to annunciate the include in the source file so I don't have
> to document the -I.
>


Hi Steve,

the problem is that, as you know, when you #include a file with "" the
compiler searches first for the current directory and then for the
standard include path (to which it adds any paths specified through
-I). Using anything like "../path/relative" is just confusing, because
you should then avoid to move any of your include files to a different
path. It is usually found more convenient to specify a directory to be
added to the include path, and there is indeed no good reason to
specify a folder at a level deeper than strictly needed, just to allow
"../path/relative" to point to something useful...

I mean, if all the include files of a project live into subfolders of
"SOMETHING/projectdir/include/" there is no reason to add
"SOMETHING/projectdir/src" to the includepath and then use
"../include/whatever.h" to include your file. This just adds unneeded
hurdles to changes/portability. And if you decide to move your
includes somewhere else, you just need to add the right path to the
include-path (not one of its subdirectories, which is really
confusing)

My2Cents

KatolaZ

--
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]