[Geany-devel] Default snippets

Alexander Eberspächer alex.eberspaecher at xxxxx
Fri Aug 26 10:57:08 UTC 2011

Dear Lex, dear list,

On Fri, 26 Aug 2011 20:39:38 +1000
Lex Trotman <elextr at gmail.com> wrote:

> My 0.5c worth, in C++ it is important to pre-increment unless you
> really need the previous value since post increment could create a
> wasted expensive copy of an object. Although an int isn't expensive,
> it is probably better to make it ++i in the for loop so it agrees with
> the usual idiom.

I changed that for C++ (revised patch attached).

Now that we go into details, let's briefly discuss assumptions being
made by those snippets:

The snippets for the loops assume that the counting variable is shall
be i. Furthermore, it is assumed that i was not declared before. This
seems to work for most people, however, I personally would opt for
completion of



"for (%cursor%)

In this case, the name of the counting variable is to be filled in by
the user (I left that decision to the user in the Fortan snippets,
too [1]). Changing the snippets towards less assumptions changes
Geany's default behaviour.

So, what do we want here? Anyone else +1 for less assumptions about what
the user wants?



[1] Considering that Fortran is mostly used in scientific computing, I
think it is reasonable to assume that `i` is not the variable the user
wants to loop over.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: default_snippets.patch
Type: text/x-patch
Size: 4696 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20110826/dc3d65ab/attachment.bin>

More information about the Devel mailing list