you've got no advantage in the case of variable-length arrays.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
>> seriously... there's a difference <<
I hardly think the difference between using the &buf[0] versus buf is worth choosing a non-portable solution.
>> you've got no advantage in the case of variable-length arrays.
Portability.
Honestly I was introduced to variable-lengths in this thread. So I'm not quite sure where it comes from. But portability won't be an issue if the future holds to this standard.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
>> Are we discussing the C++ extension or the C99 variable-arrays here?
Does it matter? Obviously we're talking about C++ since we're on the C++ board and comparing to vector. Memory management is an advantage of vector over new[]/delete[]. Portability is an advantage of vector over VLAs.
>> But portability won't be an issue if the future holds to this standard.
I'm not sure if they will be included in the C++ standard since C++ has an alternative (vectors), so until they are implemented by VC++ and other compilers and until they are included in a standard draft or technical report they aren't portable enough.
Last edited by Daved; 10-01-2008 at 12:46 PM.
all I'm getting at is inline variable length is preferable to any form of using new. vector included
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
>> all I'm getting at is inline variable length is preferable to any form of using new. vector included
I already mentioned the efficiency question, but that situation is relatively rare and if you don't have such a reason then the portable solution is better.
Well, I hope it never makes it into the standard. I really don't.
We're better off without it.
Yeah, I was thinking C++ but got a little confused over the whole forth and back here.
This is where our opinions differ
Its kinda funny. I worked several different coding teams in my career. Ada, C, C++, and Java. These people vary in their world view so wildly that it could drive you crazy. All of them are language bigots. All of them are WAY to stringent on their philosophy of proper coding. I've really come back around to a "to each his own" policy lately.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
>> I've really come back around to a "to each his own" policy lately.
I'm generally ok with that. Especially for people who know what they're doing. But on a board that helps beginners learn the language I don't see the problem explaining the advantages and disadvantages of different options, especially when there is a clear rationale to prefer one over the other.
As you might have noticed, at the beginning of this conversation I asked if you knew of a good situation of when to use dynamic arrays. I asked because I know that there are many skilled programmers out there with different habits and situations that might have a scenario that I haven't heard before. It's important to be aware of the other possible solutions. But if there is logic behind one choice and not the other, it is important to make that distinction.
The push-back that I have on that is basically driven by my recent experience with Java people. They are really well versed on OOP and design patterns but when it comes to low-level stuff, they're monkeys. Sometimes C++ people fall that way too.
It is silly to think that every possible container class necessary must already exist in the standard library. Coming down against reinventing the wheel is one thing, assuming that all small building blocks are already invented is another. Didn't the patent office make such a claim half a century ago?
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter