Changeset 7531


Ignore:
Timestamp:
06/30/18 18:54:50 (5 months ago)
Author:
baker
Message:

disable muti-byte character constant (not portable), add C #error if long is not an int and if int is not 32 bits (4 characters)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/data_sources/srusb2ew/USBXCH/Include/SrUsbXch.h

    r3957 r7531  
    1212// 
    1313 
     14/********************************************************************** 
     15 * NOTE: The layout of the .dat file header assumes long is 32-bits.  * 
     16 * On a 64-bit system, this may not be correct.  Any data types that  * 
     17 * must be 8, 16 ,or 32 bits should be declared using the C standard  * 
     18 * integer types defined in stdint.h.  Until then, fail on systems    * 
     19 * where long is not 32 bits.                                         * 
     20 **********************************************************************/ 
     21 
     22#include <limits.h> 
     23#include <stdint.h> 
     24#if ( LONG_MAX != INT32_MAX ) 
     25#error sizeof( long ) != sizeof( int ) 
     26#endif 
    1427 
    1528 
     
    11201133//                 end of the structure. 
    11211134 
    1122 #if defined( SROS_MSDOS) 
     1135/* A character constant has type int, and the internal representation is */ 
     1136/* system-dependent.  The "SROS_MSDOS" representation is more portable.  */ 
     1137 
     1138/* #if defined( SROS_MSDOS ) */ 
     1139#if 1 
    11231140#define SRDAT_HDR_ID                    (0x52535253L)    // = "SRSR" 
    11241141#else 
     
    16891706// 
    16901707 
    1691 #if defined( SROS_MSDOS) 
     1708/********************************************************************** 
     1709 * NOTE: A character constant has type int; the internal representa-  * 
     1710 * tion of a multi-character constant is system-dependent, i.e., the  * 
     1711 * order is not specified by the C standard.  The "SROS_MSDOS" repre- * 
     1712 * sentation is more portable.  The "SROS_MSDOS" constants are typed  * 
     1713 * long, but are supposed to represent the multi-character constants  * 
     1714 * that have been disabled below, which are ints cast to longs.  Fail * 
     1715 * on systems where long is not the same as int, and int is not 32    * 
     1716 * bits (four 8-bit characters).                                      * 
     1717 *********************************************************************/ 
     1718 
     1719#include <limits.h> 
     1720#include <stdint.h> 
     1721#if ( LONG_MAX != INT_MAX ) 
     1722#error sizeof( long ) != sizeof( int ) 
     1723#endif 
     1724#if ( INT_MAX != INT32_MAX ) 
     1725#error sizeof( int ) != 4 
     1726#endif 
     1727 
     1728/* #if defined( SROS_MSDOS ) */ 
     1729#if 1 
    16921730#define SRDAT_TAGID_ANALOG16    (0x36314154L)      // = "TA16" 
    16931731#define SRDAT_TAGID_ANALOG24    (0x34324154L)      // = "TA24" 
Note: See TracChangeset for help on using the changeset viewer.