[Geany-Devel] RFC: Merge C and C++ Filetypes (no troll)

Lex Trotman elextr at xxxxx
Tue Dec 29 11:24:33 UTC 2015


I'm not sure about the combination, would have to examine it further.
My only comment is to add to the point that the build commands are
different.  For example C that uses "template" as a variable won't
compile with C++, a trap for beginners or existing code (just like
Geany used to have).

But I would like to also propose (again) an orthogonal split, C/C++
headers from C/C++ bodies.  The headers need different compile
commands from the bodies.  Using the same command as happens now
generates a pre-compiled header file, and then any changes to the
header source are not seen when the body is compiled.

This can waste significant time, just because the user hit compile
after fixing a header issue, but before switching back to the body
file.  Its a really nasty trap waiting for the unaware or beginner,
and one which we shouldn't be creating.

As an alternative to separate filetypes, both of these problems could
be avoided if build commands could be different for different
extensions.  then one C/C++ filetype is definitely more viable.

Sadly a proposal that the Geany build system accommodate different
commands for different extensions, made during the last major build
system upgrade, was rejected as "too complicated".  And I'm not
interested in going back and adding it now, but would be happy to
advise anyone who wanted to do it.

I suggest that all of these issues should be examined together.

Cheers
Lex


On 29 December 2015 at 20:11, Matthew Brush <mbrush at codebrainz.ca> wrote:
> Hi,
>
> I have been using Geany without the C filetype and opening all C files as
> C++. I use about 50% each of C and C++, and since I merged the two filetypes
> quite a few of headaches went away.
>
> Some of the benefits:
>
>   - C or C++ tags always work
>   - Special highlighting of C++ keywords so I know to avoid in C
>   - All C and C++ constructs always work
>   - No ambiguity of *.h files (except w/ Obj-C)
>
> Some of the drawbacks:
>
>   - Using C++ build commands for C doesn't make much sense
>       (although some claim compiling plain C as C++ to be a virtue)
>   - The default C++ extension wouldn't be suitable for plain C
>
> Some non-issues (AFAICT):
>   - Both filetypes already use the same Scintilla C++ lexer
>   - For Geany's purposes the CTags C++ parser works for both C and C++
>
> It might be useful to only have one filetype for both. I'm content editing
> my config files locally, but I just thought it worth discussing to see if
> I'm mistaken on the perceived benefits/drawbacks.
>
> Cheers,
> Matthew Brush
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel


More information about the Devel mailing list