git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] SubmittingPatches: mention older C compiler compatibility

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 21, 2007, 12:48 UTC
Message-ID
<Pine.LNX.4.64.0705211347540.6410@racer.site>
In-Reply-To
<7vabvyfw7n.fsf@assigned-by-dhcp.cox.net>

We do not appreciate C99 initializers, declarations after statements, or "0" instead of "NULL".

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
	On Mon, 21 May 2007, Junio C Hamano wrote:
	
	> Portability rules:
	> 
	>  - We do not do C99 initializers;
	>  - We do not do decl-after-statement;
	> 
	> Readability rules:
	> 
	>  - We always write NULL, not 0, for a NULL pointer.
	> 
	> There may be a handful more unwritten rules we use.
	... so let's start with these 3.
 Documentation/SubmittingPatches |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 6a4da2d..cc74b4b 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -65,6 +65,19 @@ in templates/hooks--pre-commit.  To help ensure this does not happen,
 run git diff --check on your changes before you commit.
 
 
+(1a) Try to be nice to older C compilers
+
+We pride ourselves with the wide range of C compilers you can compile
+git with. That means that you should not use C99 initializers, even
+if a lot of compilers grok it.
+
+Also, variables have to be declared at the beginning of the block
+(you can check this with gcc, using the -Wdeclaration-after-statement
+option).
+
+Another thing: NULL pointers shall be written as NULL, not as 0.
+
+
 (2) Generate your patch using git tools out of your commits.
 
 git based diff tools (git, Cogito, and StGIT included) generate
Previous: Junio C HamanoNext: Johan Herland
Message 8 of 10 in “Submodule merge support”
  1. Submodule merge supportMartin Waitz, May 20, 2007
  2. Shawn O. PearceMay 21, 2007
  3. Martin WaitzMay 21, 2007
  4. Shawn O. PearceMay 21, 2007
  5. Junio C HamanoMay 21, 2007
  6. Alex RiesenMay 21, 2007
  7. Junio C HamanoMay 21, 2007
  8. SubmittingPatches: mention older C compiler compatibilityJohannes Schindelin, May 21, 2007
  9. Add -Wdeclaration-after-statement to CFLAGS to help enforce the instructions in SubmittingPatchesJohan Herland, May 27, 2007
  10. Morten WelinderMay 27, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.