Menu

#9 Flex C++ lexer redefines stdint.h macros  Edit

2.0
closed
nobody
1 (9)
2019-02-20
2018-01-19
Anonymous
No

Compiling a C++ lexer from Flex produces warnings that the INT*_MIN, INT*_MAX and UINT*_MAX macros from stdint.h have been redefined. When I inspected Flex's generated code, I found a block guarded by #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L which defines Flex's names for integer types. The catch is, C++ compilers don't always define that symbol, but do define the fixed-size integer types (in cstdlib.) So, a C++ compiler defines the macros itself, then includes cstdlib where they're defined again.

1 Attachments

Discussion

1 2 > >> (Page 1 of 2)
  • Anonymous

    Anonymous - 2018-10-12
    • labels: --> 1
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1 @@
    -Compiling a C++ lexer from Flex produces warnings that the `INT*_MIN`,  `INT*_MAX` and `UINT*_MAX` macros from stdint.h have been redefined.  When I inspected Flex's generated code, I found a block guarded by `#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L` which defines Flex's names for integer types. The catch is, C++ compilers don't always define that symbol, but *do* define the fixed-size integer types (in cstdlib.) So, a C++ compiler defines the macros itself, then includes cstdlib where they're defined again.
    +Compiling a C++ lexer from Flex produces warnings that the `INT*_MIN`,  `INT*_MAX` and `UINT*_MAX` macros from stdint.h have been redefined.  When I inspected Flex's generated code, I found a block guarded by `#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L` which defines Flex's names for integer types. The catch is, C++ compilers don't always define that symbol, but *do* define the fixed-size integer types (in cstdlib.) So, a C++ compiler defines the macros itself, then includes cstdlib where they're defined again.
    
    • Attachments has changed:

    Diff:

    --- old
    +++ new
    @@ -0,0 +1 @@
    +acunetix.txt (0 Bytes; text/plain)
    
    • Milestone: 2.0 --> 1.0
     
  • Anonymous

    Anonymous - 2018-10-12
    • labels: --> 1
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1 @@
    -Compiling a C++ lexer from Flex produces warnings that the `INT*_MIN`,  `INT*_MAX` and `UINT*_MAX` macros from stdint.h have been redefined.  When I inspected Flex's generated code, I found a block guarded by `#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L` which defines Flex's names for integer types. The catch is, C++ compilers don't always define that symbol, but *do* define the fixed-size integer types (in cstdlib.) So, a C++ compiler defines the macros itself, then includes cstdlib where they're defined again.
    +Compiling a C++ lexer from Flex produces warnings that the `INT*_MIN`,  `INT*_MAX` and `UINT*_MAX` macros from stdint.h have been redefined.  When I inspected Flex's generated code, I found a block guarded by `#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L` which defines Flex's names for integer types. The catch is, C++ compilers don't always define that symbol, but *do* define the fixed-size integer types (in cstdlib.) So, a C++ compiler defines the macros itself, then includes cstdlib where they're defined again.
    
    • status: open --> accepted
    • Milestone: 2.0 --> 1.0
     
  • Anonymous

    Anonymous - 2018-10-12

    1

     
  • Anonymous

    Anonymous - 2018-10-12

    1

     
  • Anonymous

    Anonymous - 2018-10-12
    • status: accepted --> closed
     
  • Anonymous

    Anonymous - 2018-10-12

    1

     
  • Anonymous

    Anonymous - 2018-10-12
    • status: closed --> wont-fix
     
  • Anonymous

    Anonymous - 2018-10-12
    • status: closed --> open
    • Milestone: 1.0 --> 2.0
     
  • Anonymous

    Anonymous - 2018-10-12

    1

     
  • Anonymous

    Anonymous - 2018-10-12

    1

     
  • Anonymous

    Anonymous - 2018-10-12
    • status: open --> accepted
     
  • Anonymous

    Anonymous - 2018-10-12

    1

     
  • Anonymous

    Anonymous - 2018-10-12
    • labels: --> 1
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1 @@
    -Compiling a C++ lexer from Flex produces warnings that the `INT*_MIN`,  `INT*_MAX` and `UINT*_MAX` macros from stdint.h have been redefined.  When I inspected Flex's generated code, I found a block guarded by `#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L` which defines Flex's names for integer types. The catch is, C++ compilers don't always define that symbol, but *do* define the fixed-size integer types (in cstdlib.) So, a C++ compiler defines the macros itself, then includes cstdlib where they're defined again.
    +Compiling a C++ lexer from Flex produces warnings that the `INT*_MIN`,  `INT*_MAX` and `UINT*_MAX` macros from stdint.h have been redefined.  When I inspected Flex's generated code, I found a block guarded by `#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L` which defines Flex's names for integer types. The catch is, C++ compilers don't always define that symbol, but *do* define the fixed-size integer types (in cstdlib.) So, a C++ compiler defines the macros itself, then includes cstdlib where they're defined again.
    
    • status: open --> unread
    • Milestone: 2.0 --> 1.0
     
  • Anonymous

    Anonymous - 2018-10-12
    • status: open --> unread
     
  • Anonymous

    Anonymous - 2018-10-12

    1

     
  • Anonymous

    Anonymous - 2018-10-12

    1

     
  • Anonymous

    Anonymous - 2018-10-12
    • status: unread --> closed
     
  • Anonymous

    Anonymous - 2018-10-12

    1

     
  • Anonymous

    Anonymous - 2018-10-12
    • status: closed --> wont-fix
     
  • Anonymous

    Anonymous - 2018-10-12
    • status: accepted --> pending
     
  • Anonymous

    Anonymous - 2018-10-12

    1

     
  • Anonymous

    Anonymous - 2018-10-12

    1

     
  • Anonymous

    Anonymous - 2018-10-12
    • status: accepted --> pending
     
  • Anonymous

    Anonymous - 2018-10-12

    1

     
  • Anonymous

    Anonymous - 2018-10-12
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1 @@
    -Compiling a C++ lexer from Flex produces warnings that the `INT*_MIN`,  `INT*_MAX` and `UINT*_MAX` macros from stdint.h have been redefined.  When I inspected Flex's generated code, I found a block guarded by `#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L` which defines Flex's names for integer types. The catch is, C++ compilers don't always define that symbol, but *do* define the fixed-size integer types (in cstdlib.) So, a C++ compiler defines the macros itself, then includes cstdlib where they're defined again.
    +Compiling a C++ lexer from Flex produces warnings that the `INT*_MIN`,  `INT*_MAX` and `UINT*_MAX` macros from stdint.h have been redefined.  When I inspected Flex's generated code, I found a block guarded by `#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L` which defines Flex's names for integer types. The catch is, C++ compilers don't always define that symbol, but *do* define the fixed-size integer types (in cstdlib.) So, a C++ compiler defines the macros itself, then includes cstdlib where they're defined again.
    
    • status: pending --> open
    • Milestone: 2.0 --> 1.0
     
1 2 > >> (Page 1 of 2)

Anonymous
Anonymous

Add attachments
Cancel