TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

C23 Implications for C Libraries

107 pointsby sigsev_251over 2 years ago

11 comments

vbtempover 2 years ago
I have a question I&#x27;ve always wanted to know but too embarrassed to ask (Especially because I&#x27;ve extensively used C for well over a decade now and am intimately familiar with it):<p>Who exactly are these new C-standards for?<p>I interact and use C on an almost daily basis. But almost always ANSI C (and <i>sometimes</i> C99). This is because every platform, architecture, etc has <i>at least</i> an ANSI C compiler in common so it serves as the least common-denominator to make platform-independent code. As such it also serves as a good target for DSLs as a sort of portable-assembly. But when you don&#x27;t need that, what&#x27;s the motivation to use C then? If your team is up-to-date enough to quickly adopt C23, then why not just use Rust or (heaven forbid, C++23)?<p>I&#x27;d love to hear from someone who does actively use &quot;modern&quot; C. I would love to be a &quot;modern C&quot; developer - I just don&#x27;t and can&#x27;t see its purpose.
评论 #33693591 未加载
评论 #33694124 未加载
评论 #33694635 未加载
评论 #33693067 未加载
评论 #33694582 未加载
评论 #33694916 未加载
评论 #33694490 未加载
评论 #33693361 未加载
评论 #33693813 未加载
评论 #33694163 未加载
评论 #33695677 未加载
评论 #33693854 未加载
评论 #33694288 未加载
评论 #33696780 未加载
评论 #33694269 未加载
评论 #33693900 未加载
评论 #33695326 未加载
评论 #33696854 未加载
avarover 2 years ago
Not new in C23, but I still think it&#x27;s a glaring hole in the standard that there&#x27;s still no standard way to ask the compiler which (if any) of &quot;J.5 Common extensions&quot; is supported.<p>For the C version you have __STDC_VERSION__, but there&#x27;s no similar facility to check if e.g. J.5.7 is supported, which effectively makes the behavior that&#x27;s explicitly omitted in 7.22.1.4 and 6.3.2.3 go from &quot;undefined&quot; to supported by C23 + the extension.<p>I understand why C can&#x27;t have some generic &quot;is this undefined?&quot; test, but it seems weird not to be able to ask if extensions defined in the standard itself are in effect, as they define certain otherwise undefined behavior. The effect is that anyone using these extensions must be intimately familiar with all the compilers they&#x27;re targeting.
phkahlerover 2 years ago
&gt;&gt; One major change in the language is that two’s complement is now mandatory as a representation for signed types.<p>This pleases me greatly. Two&#x27;s complement won decades ago. This also means they could define integer overflow as 2&#x27;s complement rollover, which is almost universal but is still considered undefined behavior.
评论 #33693410 未加载
评论 #33697154 未加载
rwmjover 2 years ago
The page gives a network error.<p>Edit: Ugh, it needs javascript to render simple HTML.
评论 #33692930 未加载
评论 #33692420 未加载
评论 #33695453 未加载
评论 #33691784 未加载
avarover 2 years ago
&quot;Extended integer types may be wider than intmax_t&quot;. I&#x27;m sure there&#x27;s a good reason for this, but it was introduced in C99, which says (in 7.8.1.5): &quot;[intmax_t] designates a signed integer type capable of representing any value of any signed integer type&quot;.<p>That was already portable between 16 bit, 32 bit, 64 bit etc. Why is it that just because the compiler supports 128 bit or 256 bit integers that compiling in such a mode doesn&#x27;t correspondingly update &quot;[u]intmax_t&quot;?<p>The linked page says they &#x27;cannot be &quot;extended integer types&quot; in the sense of C17&#x27;, but that printf() and scanf() should still support these?
评论 #33691972 未加载
评论 #33694441 未加载
评论 #33691817 未加载
zxwrtover 2 years ago
Sad that C23 didn&#x27;t get symbol visibility attributes. They are very useful for libraries. Perhaps there is still a chance to get them?
评论 #33692165 未加载
评论 #33693617 未加载
GrumpySlothover 2 years ago
<i>&gt; Trigraphs are removed from the language.</i><p>Finally! My joy knows no bounds.
评论 #33697318 未加载
评论 #33691773 未加载
ufoover 2 years ago
Why is stdbool.h deemed &quot;mostly useless now&quot;? Is it always available via another header now?
评论 #33692106 未加载
mananaysiempreover 2 years ago
Typo (I hope... :) ): BITITNT_MAX instead of BITINT_MAX, multiple times.
评论 #33695779 未加载
rurbanover 2 years ago
The last line has a typo: besearch_s =&gt; bsearch_s
dottedmagover 2 years ago
Hah<p>&gt; Extended integer types may be wider than intmax_t
评论 #33691880 未加载