bugGneural Network - Bugs: bug #49132, array_size macro in defines.h...

 
 

bug #49132: array_size macro in defines.h (extensively used in parser.c) is not portable.

Submitted by:  Ray Dillinger <rayd>
Submitted on:  Mon 19 Sep 2016 06:50:47 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Ray Dillinger <rayd>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 23 Sep 2016 04:20:56 AM UTC, comment #1:

Got rid of it. Just replaced it with const int definitions for now; parser for revised save/configure file format will probably be designed differently rendering this fix obsolete.

Ray Dillinger <rayd>
Project MemberIn charge of this item.
Mon 19 Sep 2016 06:50:47 PM UTC, original submission:

The macro compares the sizeof the array element to the sizeof the allocated array.

The problem with this is that sizeof is not defined with respect to dynamic allocations of any kind. If you get something back from malloc or calloc, it is an error (whether or not a particular compiler allows it) to call sizeof on it.

This will fail in most C compilers. It fails in gcc if options for standard conformance are turned on.

Ray Dillinger <rayd>
Project MemberIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rayd (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 23 Sep 2016 04:20:56 AM UTCraydStatusNone=>Fixed
      Assigned toNone=>rayd
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1