this post was submitted on 11 Apr 2024
29 points (100.0% liked)

C++

2022 readers
1 users here now

The center for all discussion and news regarding C++.

Rules

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 6 points 1 year ago (1 children)

Why no mention of std::array?

[–] [email protected] 5 points 1 year ago (1 children)

Why no mention of std::array?

I think this was focused on maintaining code. Replacing C-style arrays with std::array can be a daunting task, depending on how the project is structured.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

I don't really see how it's daunting enough to avoid mentioning. You can replace a C array on the stack by just swapping it with std::array. Yes, it can depend on the project structure, but that's equivalently true for any STL container the author recommended.

[–] [email protected] 3 points 1 year ago

I don’t really see how it’s daunting enough to avoid mentioning.

I think it's a good call not to mention them because they are irrelevant given the topic. If your code base and/or the consumers of your code base are using C-style arrays for input and/or output, it's hardly helpful to suggest changing all your interfaces to use another data type. It's outright impossible if you're dealing with extern C interfaces.