Skip to content

Compiler feature: warn on bad macro math #1602

@pachuco

Description

@pachuco

Feature request. I have following macro:
#define MS(X) (1000.0f/((float)(X)*(float)OPL3CLOCK))

I statically use it to define member of global struct, as MS(0.0).
This is my fault here.
I use several compilers to compile win32 target: GCC, TCC, OpenWatcom2, Digital Mars free.

All compiler preprocessor compute value to +infinity except OW2 which computes to 0.0.
Then Digital Mars also does something special: it warns me about divide by zero in static code.

Feature request: warning like DMars for such cases.

Static value resolution at your latitude.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions