3 ms·
also, I've to add this is an extremely bad question to google (not in general) "Could you explain the difference between C-style and C++-style arrays" to solv
by LoSboccacc 10y ago
also, I've to add this is an extremely bad question to google (not in general)
"Could you explain the difference between C-style and C++-style arrays"
to solve it with googling you need instead two searches (c array definition and implementation / c++ array definition and implementation) plus considerable brainpower to derive the difference.
what you're asking is thus not a piece of arcane knowledge, but involves a lot of thinking for the answerer.
a good question to ask would be 'where do I find a complete specification of c++ arrays?' - I'd be perfectly happy to sharing resources and even help searching, because it shows you're willing to put in the work to understand yourself instead of relying on someone else to do the differential analysis for you and spoon feed you the results
- cben 10y agoThis specific question formulation suffers from too vague terminology. If you asked me, I wouldn't even be sure what "C++-style arrays" means. IMHO, the most important part of the (imprecise) answer about "pointer vs std::array" was saying "std::array". Just googling that, immediately gives several results that all talk about "decaying to a pointer". "Because std::array doesn’t decay to a pointer when passed to a function, the size() function will work even if you call it from within a function:" That's golden. It doesn't fully explain the C pointer/array differences, but it points out their fundamental problem. Anyway it's not a good example of question requiring a lot of thinking. It is standard knowledge for people involved with C++, so could be a very effective thing to ask someone more experienced, except it's so basic that googling it I currently get a good SO answer on first place: https://stackoverflow.com/questions/7129717/what-does-c-style-array-mean-and-how-does-it-differ-from-stdarray-c-style https://stackoverflow.com/questions/7129717/what-does-c-styl... I strongly disagree only people who read the fine "complete specification" have done their homework. Yes, interrupting coworkers is problematic and doesn't scale, but stackoverflow does (and IRC etc are not bad). I adopting Julia's post as my new non-hostile link to how to ask questions.