Page MenuHomeFreeBSD

stdbool.h: Update for C23
ClosedPublic

Authored by minsoochoo0122_proton.me on Apr 7 2024, 2:11 AM.
Referenced Files
F141972811: D44664.id136635.diff
Wed, Jan 14, 9:19 AM
Unknown Object (File)
Wed, Jan 7, 4:33 AM
Unknown Object (File)
Tue, Jan 6, 7:56 PM
Unknown Object (File)
Tue, Jan 6, 7:55 PM
Unknown Object (File)
Thu, Jan 1, 9:12 AM
Unknown Object (File)
Wed, Dec 31, 12:37 PM
Unknown Object (File)
Sat, Dec 27, 7:48 PM
Unknown Object (File)
Fri, Dec 26, 2:21 PM

Details

Summary

When a compiler with C23 or higher is detected, builtin bool, true,
and false are used to conform the C23 standard.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Add __STDC_VERSION_STDBOOL_H__ as the header file now conforms C23.

imp requested changes to this revision.Apr 7 2024, 3:38 AM
imp added inline comments.
include/stdbool.h
30

This doesn't match normal header practice.
I'd be tempted to just use #pragma once

48

Why?

This revision now requires changes to proceed.Apr 7 2024, 3:38 AM
include/stdbool.h
30

This doesn't match normal header practice.
I'd be tempted to just use #pragma once

C23 N3220 draft

This is a version test macro that tells the current implmented C standard version of a header file.

  • 7.1.2 (Standard Headers)
    • 6: Some standard headers define or declare identifiers that had not been present in previous versions of this document. To allow implementations and users to adapt to that situation, they also define a version macro for feature test of the form __STDC_VERSION_ XXXX_H__ which expands to 202311L, where XXXX is the all-caps spelling of the corresponding header <xxxx.h>.
48

Why?

I wanted to make sure that those are keywords in C23 and c++, but now it seems redundant. I'll remove them.

OK. This looks ready to go then. Sorry for my slowness in responding

include/stdbool.h
30

This doesn't match normal header practice.
I'd be tempted to just use #pragma once

C23 N3220 draft

This is a version test macro that tells the current implmented C standard version of a header file.

  • 7.1.2 (Standard Headers)
    • 6: Some standard headers define or declare identifiers that had not been present in previous versions of this document. To allow implementations and users to adapt to that situation, they also define a version macro for feature test of the form __STDC_VERSION_ XXXX_H__ which expands to 202311L, where XXXX is the all-caps spelling of the corresponding header <xxxx.h>.

Right. That makes sense now that I know it's the 'new standard' to do it like that.

This revision is now accepted and ready to land.Jun 3 2024, 5:06 PM
This revision was automatically updated to reflect the committed changes.