[Github-comments] [geany/geany] Fix the current scope shown in the statusbar (#1280)

Matthew Brush notifications at xxxxx
Sat Oct 29 11:13:43 UTC 2016


codebrainz commented on this pull request.



> @@ -2289,6 +2290,32 @@ static gint get_fold_header_after(ScintillaObject *sci, gint line)
 }
 
 
+/* returns the line after following all brace match for @brace on @line */
+static gint resolve_matching_braces(ScintillaObject *sci, gint line, gint brace)
+{
+	gint pos = sci_get_position_from_line(sci, line);
+	gint line_end = sci_get_line_end_position(sci, line);
+	gint lexer = sci_get_lexer(sci);

I propose something like the following changes to `HACKING`:

```diff
diff --git a/HACKING b/HACKING
index 938688d..13e4025 100644
--- a/HACKING
+++ b/HACKING
@@ -200,8 +200,18 @@ Coding
   moment, we want to keep the minimum requirement for GTK at 2.24 (of
   course, you can use the GTK_CHECK_VERSION macro to protect code using
   later versions).
-* Variables should be declared before statements. You can use
-  gcc's -Wdeclaration-after-statement to warn about this.
+* Variables should be declared (and initialized) as close as practical
+  to their first use. This reduces the chances of intervening code being
+  inserted between declaration and use, where the variable may be
+  uninitialized.
+* Variables should be defined within the smallest scope that is practical,
+  for example inside a conditional branch which uses them or in the
+  initialization part of a for loop.
+* Local variables that will not be modified should be marked as ``const``
+  to indicate intention. This allows the compiler to give a warning if
+  part of the code accidentally tries to change the value. This does not
+  apply to by-value parameters where it needlessly exposes the
+  implementation and it's obvious a copy is made anyway.
 * Don't let variable names shadow outer variables - use gcc's -Wshadow
   option.
 * Do not use G_LIKELY or G_UNLIKELY (except in critical loops). These
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1280
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20161029/2e3f42cb/attachment.html>


More information about the Github-comments mailing list