|
|
Subscribe / Log in / New account

Malcolm: Usability improvements in GCC 9

Malcolm: Usability improvements in GCC 9

Posted Mar 11, 2019 8:15 UTC (Mon) by tdz (subscriber, #58733)
In reply to: Malcolm: Usability improvements in GCC 9 by dvdeug
Parent article: Malcolm: Usability improvements in GCC 9

While C++'s STL much better than the data structures in C standards, it can lead to excessive object copying. I think C's strong domain is where overhead really matters, so STL might not be appropriate in these environments.

OTOH, I'd wish the ISO C committee would simply standardize the stuff in <sys/queue.h>. This should do the job in nearly all cases. POSIX provides insque() and remque(), which are so laughable that one wonders why they bothered standardizing it at all.


to post comments

Malcolm: Usability improvements in GCC 9

Posted Mar 11, 2019 8:19 UTC (Mon) by Cyberax (✭ supporter ✭, #52523) [Link] (4 responses)

> While C++'s STL much better than the data structures in C standards, it can lead to excessive object copying.
This might have been true in C++03 (although even there NRVO and RVO optimized away a lot of copies) but C++11 and more recent versions have much more robust move semantics.

Malcolm: Usability improvements in GCC 9

Posted Mar 11, 2019 8:30 UTC (Mon) by tdz (subscriber, #58733) [Link] (3 responses)

True. But move semantics are in some way a workaround for the excessive-copying problem of these earlier versions. And (sane use of) STL also requires C++ exceptions, which are often not available in resource-limited environments.

Malcolm: Usability improvements in GCC 9

Posted Mar 11, 2019 9:11 UTC (Mon) by Cyberax (✭ supporter ✭, #52523) [Link] (2 responses)

There are STLs that work just fine without exceptions, you actually don't need them for most of the library if you just ignore the epic failure that are the iostreams.

Also, SJLJ exceptions are actually quite reasonable even for small environments (something a bit larger than 16 bit Arduino).

And then there's this nice proposal: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p... - it won't make into the coming revision of the standard, but it's on the table for the next one.

Malcolm: Usability improvements in GCC 9

Posted Mar 11, 2019 11:42 UTC (Mon) by tdz (subscriber, #58733) [Link] (1 responses)

> There are STLs that work just fine without exceptions

There are, but C++ without exceptions is not what I call "sane use of."

Malcolm: Usability improvements in GCC 9

Posted Mar 12, 2019 17:10 UTC (Tue) by k8to (guest, #15413) [Link]

Imo, C++ without exceeptions works for certain use cases, like embedded codebases. But STL without exceptions sounds very bad.

Malcolm: Usability improvements in GCC 9

Posted Mar 11, 2019 18:08 UTC (Mon) by rweikusat2 (subscriber, #117920) [Link] (1 responses)

> While C++'s STL much better than the data structures in C standards,

There are no "data structures" in C standards, there's just a convention for representing strings.

Malcolm: Usability improvements in GCC 9

Posted Mar 12, 2019 9:21 UTC (Tue) by tdz (subscriber, #58733) [Link]

Because it's not a data structure unless it's wrapped in 'struct { }'


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds