Page MenuHomeFreeBSD

assert(3): Update with _Static_assert
ClosedPublic

Authored by kfv_kfv.io on Apr 19 2021, 10:50 AM.
Tags
None
Referenced Files
F102427005: D29833.diff
Tue, Nov 12, 3:11 AM
Unknown Object (File)
Fri, Nov 8, 4:12 AM
Unknown Object (File)
Fri, Nov 1, 6:17 AM
Unknown Object (File)
Sun, Oct 27, 9:31 AM
Unknown Object (File)
Thu, Oct 17, 12:27 PM
Unknown Object (File)
Wed, Oct 16, 1:35 AM
Unknown Object (File)
Oct 12 2024, 3:34 PM
Unknown Object (File)
Oct 10 2024, 4:49 PM
Subscribers

Diff Detail

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

Event Timeline

Note: usually we try to avoid "you" in the documentation.

Also, I don't know much about static_assert. We may need a src committer help here.

Ah, I again made that mistake! Sorry :-(

share/man/man3/assert.3
102

I'd add an example too.

static_assert(sizeof(int) == sizeof(void *), "ints and pointers are different sizes");

  • assert(3): rephrase and remove the "your" determiner
share/man/man3/assert.3
102

Sure, I will update it shortly. Thanks.

  • assert(3): add an example for static_assert()
  • assert(3): add an example for static_assert()

Fixup!

kfv_kfv.io added inline comments.
share/man/man3/assert.3
102

I just added an example, please let me know if I should add more or change anything. Thanks!

This revision is now accepted and ready to land.Apr 19 2021, 10:01 PM
This revision was automatically updated to reflect the committed changes.
arichardson added inline comments.
share/man/man3/assert.3
90–91

Not sure if you also want to mention C++ here. This statement is only true for C, in C++11 static_assert is a keyword and _Static_assert. GCC rejects _Static_assert in C++ mode while clang accepts it.

share/man/man3/assert.3
90–91

Completely true. _Static_assert does not exist in C++, and that's why using static_assert is mostly preferred. And this is indeed very good to educate the reader. But I think we predominantly discuss C topics, and since a lot of things differ in C++, I think this is not necessary to delve into such details.