bugThe FreeType Project - Bugs: bug #38503, Please consider using the sizeof...

 
 

bug #38503: Please consider using the sizeof operator instead of autoconf hard-coded values for int-type sizes

Submitted by:  Michał Górny <michalgorny>
Submitted on:  Mon 11 Mar 2013 07:17:01 PM UTC  
 
Severity: 3 - NormalItem Group: None
Status: InvalidPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 11 Mar 2013 08:10:34 PM UTC, comment #2:

:-)

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 11 Mar 2013 07:48:25 PM UTC, comment #1:

Oh, never mind. I guess I didn't test it properly the first time.

Michał Górny <michalgorny>
Mon 11 Mar 2013 07:17:01 PM UTC, original submission:

The ftconfig.h file on Unix has two logics for obtaining integer type sizes: one involving using values auto-detected during build-time, the other using some horrible hacks.

Is there a reason why the sizeof operator can not be simply used? As far as I understand the C standard, sizeof can be used in '#if' as it is a regular operator yielding constant integer value.

The current auto-detected solution means that headers are quite tied to specific compiler options, esp. wrt -m64/-m32 and the long type.

I'm specifically thinking of something like:

#ifdef FT_USE_AUTOCONF_SIZEOF_TYPES

#define FT_SIZEOF_INT sizeof(int)
#define FT_SIZEOF_LONG sizeof(long)

#else /* !FT_USE_AUTOCONF_SIZEOF_TYPES */

which would use the sizeof operator properly and still provide an ability to fallback to the value hackery.

Michał Górny <michalgorny>

 

(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 wl (Posted a comment)
  • -unavailable- added by michalgorny (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
    Mon 11 Mar 2013 08:10:34 PM UTCwlStatusNone=>Invalid
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1