Skip to content

static_assert is C23, rather use _Static_assert #61

@barracuda156

Description

@barracuda156

static_assert is C23, so it won’t work unless the standard is forced, but _Static_assert works fine.

In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_blisp/blisp/work/blisp-0.0.4/lib/blisp_easy.c:3:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_blisp/blisp/work/blisp-0.0.4/include/blisp_struct.h:157:15: error: expected declaration specifiers or '...' before 'sizeof'
  157 | static_assert(sizeof(struct bfl_boot_header) == 176,
      |               ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_blisp/blisp/work/blisp-0.0.4/include/blisp_struct.h:158:15: error: expected declaration specifiers or '...' before string constant
  158 |               "Bootheader have wrong size");
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_blisp/blisp/work/blisp-0.0.4/include/blisp_struct.h:167:15: error: expected declaration specifiers or '...' before 'sizeof'
  167 | static_assert(sizeof(struct blflash_segment_header) == 16,
      |               ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_sysutils_blisp/blisp/work/blisp-0.0.4/include/blisp_struct.h:168:15: error: expected declaration specifiers or '...' before string constant
  168 |               "Segment header have wrong size");
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Ref: https://en.cppreference.com/w/c/language/_Static_assert

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions