patchFreeciv - Patches: patch #3603, CodingStyle: Do not initialize...

 
 
Show feedback again

patch #3603: CodingStyle: Do not initialize variables with nonsensical values

Submitted by:  Marko Lindqvist <cazfi>
Submitted on:  Sat 19 Jan 2013 10:15:22 AM UTC  
 
Category: docsPriority: 5 - Normal
Status: DonePrivacy: Public
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Closed
Planned Release: 2.3.4, 2.4.0, 2.5.0

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 21 Jan 2013 06:39:39 PM UTC, SVN revision 22177:

Instruct against initializing variables at all if one cannot
initialize with what can be considered correct value.

See gna patch #3603

(Browse SVN revision 22177)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon 21 Jan 2013 06:39:34 PM UTC, SVN revision 22176:

Instruct against initializing variables at all if one cannot
initialize with what can be considered correct value.

See gna patch #3603

(Browse SVN revision 22176)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon 21 Jan 2013 06:39:29 PM UTC, SVN revision 22175:

Instruct against initializing variables at all if one cannot
initialize with what can be considered correct value.

See gna patch #3603

(Browse SVN revision 22175)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sat 19 Jan 2013 10:15:22 AM UTC, original submission:

This one goes against what earlier days was taught as good programming practice, but with modern tools I think that avoiding variable initialization "just in case" makes better code in the long run. Using wrong value (with what variable happened to be initialized with) doesn't make it any better than using uninitialized value, but such a initialization hides the problem from debugging tools (gcc warnings, valgrind reports)

So, attached patch against CodingStyle says that variables for which there's no correct initialization value, must be left uninitialized.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #16973:  DontInitialize.patch added by cazfi (759B - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by cazfi (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 21 Jan 2013 06:40:05 PM UTCcazfiStatusReady For Test=>Done
      Assigned toNone=>cazfi
      Open/ClosedOpen=>Closed
    Sat 19 Jan 2013 10:15:22 AM UTCcazfiAttached File-=>Added DontInitialize.patch, #16973
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup