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
Unknown Object (File)
Mon, Sep 16, 11:55 AM
Unknown Object (File)
Sun, Sep 15, 1:52 PM
Unknown Object (File)
Wed, Sep 11, 11:42 PM
Unknown Object (File)
Sun, Sep 8, 12:58 AM
Unknown Object (File)
Sat, Sep 7, 12:24 PM
Unknown Object (File)
Fri, Sep 6, 1:43 AM
Unknown Object (File)
Thu, Aug 29, 3:19 AM
Unknown Object (File)
Wed, Aug 28, 10:42 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.