Strange variable corruption

Discussion to talk about software related topics only.
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: Strange variable corruption

Post by tod »

I should point out I wasn't directing my comments at you (or even at Dave), I just saw this thread as a good opportunity to raise awareness of <iostream> and <sstream>. All I'm after is a response like yours, where people consider using the C++ standard libraries. After all most of them have been around for over 20 years now, they're very well tested, and a lot of them were designed to overcome the problems inherent in the C Libraries. I updated my wiki article on moving to C++ see the section on Easy First Steps.
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: Strange variable corruption

Post by v8dave »

Cheers tod.

I hadn't really looked at C++ for embedded before moving to the Netburner so I was still using C style programming. Like rnixon I like to try and stick with fixed memory allocation or at least dynamic allocation that is created at the start of the programme and does not change. Saying that, the graphics library I have is using malloc for saving the screen state but what I have done it created 2 memory allocations at the start and just point to these when needed. They may be bigger than needed most of the time, but this way I know I am not freeing memory on a regular basis.

I will look at the stream libraries now too but not done much with them before. Cheers for the heads up.

Dave...
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: Strange variable corruption

Post by rnixon »

Tod, I think thats great and was the point I tried to get across. Your comments and wiki pages are excellent and I have learned a lot from them.
Ridgeglider
Posts: 513
Joined: Sat Apr 26, 2008 7:14 am

Re: Strange variable corruption

Post by Ridgeglider »

Tod:
I also commend you for taking the time to explicitly describe these details. You've made lots of great posts over the years -- always worth checking out!

Thanks
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: Strange variable corruption

Post by tod »

Thanks all. It's nice to know. I feel the NetBurner products give us a big advantage because there is excellent C++ support. Who knows we might even have early support of C++ 0x! I think if more of NetBurner's sample code was written in a true C++ idiom we would see more NetBurner programmers adopting it.

P.S. I should point out that it's especially nice to hear kind words from rnixon and ridgeglider. I've been hanging out here long enough to recognize that both of you have helped me and others out countless times.
Post Reply