C++ is not GC'd and the line "return Foo(somearg).bar(someotherarg);" works perfectly fine, with the added benefit of the compiler inserting the appropriate constructor and destructor calls as well as all the memory allocation house keeping. This doesn't necessarily mean excessive stack usage either, since there's nothing in that line of code that indicates how these objects are implemented.
Why does your mind boggle? Have you never met stupid (read average) people before? They always know what's best without knowing much of anything at all.
I hate to nit-pick, but in this case the false information is the signal that there's no information when there is. As long as something could be interpreted, it is a signal. Moving on to a new location while not revealing that something was found, is signaling that nothing was found -- false signal -- deception.
me: but the brand you wear shouldn't make a difference what friends you have. We don't have the money to buy these expensive clothes or to get you a cell phone.
I'm not a parent.
But, I do see a fundamental problem with the approach. "Shouldn't," however logical, does not have the impact it "should". Strictly from memory, and what my younger sister is going through, everything seems to circle around "what is".
I am totally prepared that I'm way of track here, but completely ignoring said "what is," tends to send off said anecdotal examples into a fit of unexplainable rage and sometimes damaging the house.
Is there anybody out there of reasonable intelligence that actually thinks that there's a debate going on at all? From what my feeble mind has observed, I find that those who jump to their conclusions are rather small minded creatures who lack any sort of real imagination... constantly regurgitating the same unverifiable babble and staking their life on it too. The other end of the spectrum... where I dwell, I guess, is admitting to yourself that we just don't know everything, and REFUSE to assume ANYTHING, and simply observe.
It's rather funny that if one does observe, one tends to see evolution in action almost everywhere. This "debate" too is evolving. New intellectual weaponry invented decade after decade all designed to curb the other side.
Perhaps the real issue is that the people "debating" have no business being in a debate to begin with. Again, an observation, but those involved seem like nothing more than hyper emotional twits who simply can't figure out why 2(x+y) is 2x+2y. Just to be clear, the math is purely illustrative of the problem as I see it.
I think this greatly depends on the college. Last thing he needs is to end up where I went. I was fortunate enough to have the personal interest to actually learn the stuff on my own.
How is this Insightful? It's a troll. Nothing more. The GP did nothing but offer a solution. Yes, it is cryptic for the newb, but this wasn't for a newb audience.
A _LOT_ of people that I deal with do not comprehend what an smtp server is. I still have to tell them what to fill in the little text box. As far as I can tell they still don't know what it is, and yet, somehow, they are using their email client.
What's even more ironic is that same president, or someone very close to her (I too am too lazy to find the link) uses penicillin because even though it's an animal byproduct, it allows her to survive to further the PETA cause, making the sacrifice an "OK" one... somehow.
Bunch of hypocrites... giving the rest of us hippies a bad name.
would think it would be a lot more robust to keep track of allocation and deallocation explicitly, add when you need, and delete when you don't need, and not count on some generic mechanism.
Ok... so I allocate object A. Then I allocate object B, C, and D that all reference A but aren't aware of eachother. Then I release D, and don't know whether to release A, so now A needs to have some sort of reference counting mechanism, and I have to remember to use it each time I create or copy or pass a reference to A.
Say you are using C++, in this case, the problem you're describing easily lends itself to the proxy pattern. Whereby you define a class to represent the handle & reference counting semantics for you. Since this is a very generic pattern, that class definition is probably just one line of code and the include. You then never even think about the original class, and use the handle class as if it was the original class.
Or... I can use a language that implements the reference counting stuff for me and implicitly calls it when I allocate new objects, create, copy, or pass references, and expire them as they go out of scope, without me having to write explicit destructors.
The above scheme gives you exactly what you crave. It also has this nifty property of being specialised for differing purposes / optimisations as necessary. This is usually done through an additional template parameter that is set to a good generic default.
The language that implements this stuff for you rarely lets you adjust anything if you have good reason to, they only provide the defaults.
Basically, if you do any sort of remotely complicated object allocation where you are going to need to implement reference counting to keep track of them, you might as well use a garbage collector. That's what it does, it comes thoroughly debugged, and you don't have to waste time implementing and debugging your own.
You do not have to debug your empty class, and the compiler will happily complain if you're using it wrong.
So, a garbage collector language is MORE robust (assuming robust means 'more reliable').
A garbage collected language is robust provided the problem you are solving maps well to the memory management techniques employed by the garbage collector. As soon as the problem steps outside of that domain, you're in the same boat as a C programmer, having to do all your method calling explicitly to make sure things go right.
On the other hand, with a templating scheme (I love my templates), you have a powerful and robust way to implement what you need by simple configuration.
That said, I am very well aware of how easy it is to abuse templates in general, and am not of the opinion that they are the magic hammer and that all problems are now nails.
That's not to say unmanaged code doesn't have its place, but in my experience managed code tends to get developed faster and cheaper than equivalent unmanaged code, so it only makes sense to use unmanaged code where you really need the performance or nuts&bolts control. Your typical productivity or business logic application don't. Drivers, real-time systems, etc do.
The domain of C++ is any general computing problem for which C++ provides appropriate abstractions for. That's pretty damn nearly everything out there in the business world and then some, since C++ provides: functions, fully runtime polymorphic classes, as well as the ability to overload almost any operator, all within the generic context of templates. Putting that together gives you something that looks like weird python derivative.
You may argue that I'm only offsetting the quantity of code involved to the library files I'm linking, and that my short programs are longer than they seem. But I would say that the only real difference is that in a managed program the extra code is in the manager itself serving exactly the same purpose.
As always, use the best tool for the job. C is not always the best tool.
There is no way to do what you are proposing unless free() is a JNI method.
Multiple previous posts have repeatedly stated that once you are inside a JNI method, you are no longer programming in Java.
The language, as it is, provides absolutely no syntax to "free" b. As long as you can use b, it points to that array. Again, only with JNI is this even conceivable, and JNI is NOT Java, it's C, with it's own rules about EVERYTHING.
This too is simply a matter of experience. Instead of grabbing an API for parsing XML, grab an API for a recursive descent parser and make an XML parser out of it.
Unless specifically instructed to produce all of the API code yourself, which is an entirely different topic than that of making parsers, don't do it. That setting will put too much in your lap all at once, rendering your effective learning to being sub-par in both subjects.
Its a matter of experience. The parent isn't realising that you haven't really worked enough with data structures, in general, which really helps knowing the ins and outs of what to do after you parse the data. In essence, you are asking a very different question than the one you worded.
The parent is stating that: Of the variety of parsing tasks out there to do, with the level of support available in terms of API's and frameworks, working with XML could be seen as slicing butter with a hot knife. Relatively, it's pretty easy.
The part that you found non-trivial isn't the parsing, it's figuring out what to do with the data once you parsed it.
Just figure out some sort of abstract structure of what the XML file is supposed to represent. That structure is a higher level structure than say, the DOM tree you get. Use it to wrap over the DOM objects to hide away the details. All this assumes you're using DOM. You could be using something else, but it's a matter of reorganising similar concepts.
Do you not realize that you have to recompile software for it to run properly, period? It doesn't matter what software or OS we're talking about either. Just because someone else does it for you does not mean that it does not get done. Even on your precious Windows.
You make it sound like it's a deficiency with C. Many would disagree.
C++ is not GC'd and the line "return Foo(somearg).bar(someotherarg);" works perfectly fine, with the added benefit of the compiler inserting the appropriate constructor and destructor calls as well as all the memory allocation house keeping. This doesn't necessarily mean excessive stack usage either, since there's nothing in that line of code that indicates how these objects are implemented.
I'm pretty sure this is a Monty Python reference people. Learn thy culture!
Also notice that the software used (Text Editor) comes from Gnome...
wow... not to sound like flamer... I have to say, writing a loop to do this is anything but intuitive.
Why did you bother posting?
Long Live Bill
He maybe resting in peace, but what he said will live forever in the hearts of those that have one.
Why does your mind boggle? Have you never met stupid (read average) people before? They always know what's best without knowing much of anything at all.
Yes, I think you are. This is the sort of safeguard that I think is simply invaluable in so many more places... It's a shame it's not the norm.
I hate to nit-pick, but in this case the false information is the signal that there's no information when there is. As long as something could be interpreted, it is a signal. Moving on to a new location while not revealing that something was found, is signaling that nothing was found -- false signal -- deception.
me: but the brand you wear shouldn't make a difference what friends you have. We don't have the money to buy these expensive clothes or to get you a cell phone.
I'm not a parent.
But, I do see a fundamental problem with the approach. "Shouldn't," however logical, does not have the impact it "should". Strictly from memory, and what my younger sister is going through, everything seems to circle around "what is".
I am totally prepared that I'm way of track here, but completely ignoring said "what is," tends to send off said anecdotal examples into a fit of unexplainable rage and sometimes damaging the house.
I really am not trolling or flaming.
Is there anybody out there of reasonable intelligence that actually thinks that there's a debate going on at all? From what my feeble mind has observed, I find that those who jump to their conclusions are rather small minded creatures who lack any sort of real imagination... constantly regurgitating the same unverifiable babble and staking their life on it too. The other end of the spectrum... where I dwell, I guess, is admitting to yourself that we just don't know everything, and REFUSE to assume ANYTHING, and simply observe.
It's rather funny that if one does observe, one tends to see evolution in action almost everywhere. This "debate" too is evolving. New intellectual weaponry invented decade after decade all designed to curb the other side.
Perhaps the real issue is that the people "debating" have no business being in a debate to begin with. Again, an observation, but those involved seem like nothing more than hyper emotional twits who simply can't figure out why 2(x+y) is 2x+2y. Just to be clear, the math is purely illustrative of the problem as I see it.
I just don't got em :(
Haha nice, one of the best movies ever.
That's not the point.
I think this greatly depends on the college. Last thing he needs is to end up where I went. I was fortunate enough to have the personal interest to actually learn the stuff on my own.
How is this Insightful? It's a troll. Nothing more. The GP did nothing but offer a solution. Yes, it is cryptic for the newb, but this wasn't for a newb audience.
A _LOT_ of people that I deal with do not comprehend what an smtp server is. I still have to tell them what to fill in the little text box. As far as I can tell they still don't know what it is, and yet, somehow, they are using their email client.
That's the one! I should have had more coffee.
What's even more ironic is that same president, or someone very close to her (I too am too lazy to find the link) uses penicillin because even though it's an animal byproduct, it allows her to survive to further the PETA cause, making the sacrifice an "OK" one... somehow.
Bunch of hypocrites... giving the rest of us hippies a bad name.
Why would understanding your current culture hold you back?
would think it would be a lot more robust to keep track of allocation and deallocation explicitly, add when you need, and delete when you don't need, and not count on some generic mechanism.
Ok... so I allocate object A. Then I allocate object B, C, and D that all reference A but aren't aware of eachother. Then I release D, and don't know whether to release A, so now A needs to have some sort of reference counting mechanism, and I have to remember to use it each time I create or copy or pass a reference to A.
Say you are using C++, in this case, the problem you're describing easily lends itself to the proxy pattern. Whereby you define a class to represent the handle & reference counting semantics for you. Since this is a very generic pattern, that class definition is probably just one line of code and the include. You then never even think about the original class, and use the handle class as if it was the original class.
Or... I can use a language that implements the reference counting stuff for me and implicitly calls it when I allocate new objects, create, copy, or pass references, and expire them as they go out of scope, without me having to write explicit destructors.
The above scheme gives you exactly what you crave. It also has this nifty property of being specialised for differing purposes / optimisations as necessary. This is usually done through an additional template parameter that is set to a good generic default.
The language that implements this stuff for you rarely lets you adjust anything if you have good reason to, they only provide the defaults.
Basically, if you do any sort of remotely complicated object allocation where you are going to need to implement reference counting to keep track of them, you might as well use a garbage collector. That's what it does, it comes thoroughly debugged, and you don't have to waste time implementing and debugging your own.
You do not have to debug your empty class, and the compiler will happily complain if you're using it wrong.
So, a garbage collector language is MORE robust (assuming robust means 'more reliable').
A garbage collected language is robust provided the problem you are solving maps well to the memory management techniques employed by the garbage collector. As soon as the problem steps outside of that domain, you're in the same boat as a C programmer, having to do all your method calling explicitly to make sure things go right.
On the other hand, with a templating scheme (I love my templates), you have a powerful and robust way to implement what you need by simple configuration.
That said, I am very well aware of how easy it is to abuse templates in general, and am not of the opinion that they are the magic hammer and that all problems are now nails.
That's not to say unmanaged code doesn't have its place, but in my experience managed code tends to get developed faster and cheaper than equivalent unmanaged code, so it only makes sense to use unmanaged code where you really need the performance or nuts&bolts control. Your typical productivity or business logic application don't. Drivers, real-time systems, etc do.
The domain of C++ is any general computing problem for which C++ provides appropriate abstractions for. That's pretty damn nearly everything out there in the business world and then some, since C++ provides: functions, fully runtime polymorphic classes, as well as the ability to overload almost any operator, all within the generic context of templates. Putting that together gives you something that looks like weird python derivative.
You may argue that I'm only offsetting the quantity of code involved to the library files I'm linking, and that my short programs are longer than they seem. But I would say that the only real difference is that in a managed program the extra code is in the manager itself serving exactly the same purpose.
As always, use the best tool for the job. C is not always the best tool.
And I never said it was :).
There is no way to do what you are proposing unless free() is a JNI method.
Multiple previous posts have repeatedly stated that once you are inside a JNI method, you are no longer programming in Java.
The language, as it is, provides absolutely no syntax to "free" b. As long as you can use b, it points to that array. Again, only with JNI is this even conceivable, and JNI is NOT Java, it's C, with it's own rules about EVERYTHING.
This too is simply a matter of experience. Instead of grabbing an API for parsing XML, grab an API for a recursive descent parser and make an XML parser out of it.
Unless specifically instructed to produce all of the API code yourself, which is an entirely different topic than that of making parsers, don't do it. That setting will put too much in your lap all at once, rendering your effective learning to being sub-par in both subjects.
Its a matter of experience. The parent isn't realising that you haven't really worked enough with data structures, in general, which really helps knowing the ins and outs of what to do after you parse the data. In essence, you are asking a very different question than the one you worded.
The parent is stating that: Of the variety of parsing tasks out there to do, with the level of support available in terms of API's and frameworks, working with XML could be seen as slicing butter with a hot knife. Relatively, it's pretty easy.
The part that you found non-trivial isn't the parsing, it's figuring out what to do with the data once you parsed it.
Just figure out some sort of abstract structure of what the XML file is supposed to represent. That structure is a higher level structure than say, the DOM tree you get. Use it to wrap over the DOM objects to hide away the details. All this assumes you're using DOM. You could be using something else, but it's a matter of reorganising similar concepts.
Lather, rinse, repeat till it's second nature
Wow indeed...
Do you not realize that you have to recompile software for it to run properly, period? It doesn't matter what software or OS we're talking about either. Just because someone else does it for you does not mean that it does not get done. Even on your precious Windows.
What rock did you climb out from under?