Re: IS this a proper way of freeing memory with free()



Richard Heathfield wrote:
Ian Collins said:

Richard Heathfield wrote:

Fine, in which case it isn't C++, so you don't need the cast on
malloc.


I'm not sure if you are being deliberately obtuse.

No, I'm usually pretty acute.

I had noticed...

My point is there is sometimes value in having C code which is valid
C++. The driver code in question is compiled as C for the embedded
target, but compiled with the host C++ compiler for testing in a
hardware simulator.

Not wise, in my opinion. Your test environment does not adequately
reflect your production environment.

The value gained form being able to test drivers or a complete embedded
system off the target. We built up a very accurate simulation of the
micro we were using which enabled us to fully test our software before
we had hardware.

You wouldn't try to pull that
stunt with Perl on the target and COBOL on the simulator, would you? So
why do it with C and C++?

Is there a common subset of Perl and COBOL?

So the code in question is written in the subset of C that is valid
C++.

With identical semantics? Are you *sure*? And once you've answered in
the affirmative, ask yourself whether you are *really* sure.

Yes, and we back that up with acceptance tests that run against the
simulation and the final product.

--
Ian Collins.
.



Relevant Pages

  • Re: Build your own Forth for Microchip PIC: Design thoughts
    ... compiler is the only task that's burning in my brain right. ... that puts PIC code on the host for the simulator to execute. ... I'm not so sure about the simulator. ... That target will execute compiled forth words. ...
    (comp.lang.forth)
  • Re: C- Programming for ARM Microcontrollers
    ... the compiler is becoming less and less of an issue. ... test in the simulator for the target. ... testing on a PC, rather than a simulator, becomes possible. ...
    (comp.arch.embedded)
  • Re: C- Programming for ARM Microcontrollers
    ... I wonder how long it will be before compiler efficiency is a moot point ... test in the simulator for the target. ... testing on a PC, rather than a simulator, becomes possible. ...
    (comp.arch.embedded)
  • Re: Build your own Forth for Microchip PIC (Episode 837)
    ... the unreasonablly small hardware stack size for my particular target. ... You are handcuffed in the sense that you would like to be able to download small amounts of code into ram and execute it. ... because once you do away with the inner interpreter, ... An optimizing compiler isn't a post-processor, it's an *alternative* to another kind of compiler. ...
    (comp.lang.forth)
  • Re: Build your own Forth for Microchip PIC (Episode 837)
    ... put those tokens in RAM. ... This is the reason I'm wanting to use the host as a remote execution ... Test/Debug code on target recompiling and reloading as necessary. ... of implementing anything other than a batch forth compiler for it. ...
    (comp.lang.forth)