Re: free()



On Feb 10, 2:13 pm, "santosh" <santosh....@xxxxxxxxx> wrote:
things yourself. One safe practise is to immediately set a pointer to
NULL after calling free() on it. Passing a null pointer to free() is
harmless.

this is a very bad idea.

instead of having your code crash like hell in the
first phases of debugging, which will allow you
to fix the thing quick & properly, you will happily
call free() many times on the same pointer, and
build crap around that broken logic, and then
call for a garbage collector :)

.



Relevant Pages

  • Re: [PATCH] [0/9] Use 64bit x86 machine check code for 32bit too
    ... warning: passing argument 2 of ‘strict_strtoull’ makes integer from pointer without a cast ...
    (Linux-Kernel)
  • Re: Critical section shared betwen dll and main program
    ... I am discussing the case of dynamic DLL ... loading and passing PCRITICAL_SECTION between old version of DLL ... and an executable which was build in newer environment. ... without passing a pointer to the kernel32.dll? ...
    (microsoft.public.win32.programmer.kernel)
  • Re: [opensuse] Promise SATA300-4TX kernel Module Fails to Build?
    ... passing argument 2 of ‘writeb’ makes pointer from integer without a cast ... missing whitespace after the macro name ...
    (SuSE)
  • TRICK: Unique IDing
    ... Sometimes it's hard to get straight when passing or storing or returning an ... pointer to a copy of the target instance. ... class MyClass ... ID) and compare it against the suspect. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: TRICK: Unique IDing
    ... > pointer to the target instance or a pointer to a copy of the target ... When passing an instance of a class it can be done so the ... > class MyClass ... > you want ) and compare it against the suspect. ...
    (microsoft.public.dotnet.languages.vc)