Re: use delete to destroy primitive/object types but memory is not freed
From: jimjim (FreeBSD_net_at_blueyonder.co.uk)
Date: 04/08/04
- Next message: Joe Wright: "Re: Newbie: Searching for a Projekt to practice C programming"
- Previous message: code_wrong: "Re: how to remove a character from a string"
- In reply to: Alan Balmer: "Re: use delete to destroy primitive/object types but memory is not freed"
- Next in thread: Stephen Sprunk: "Re: use delete to destroy primitive/object types but memory is not freed"
- Reply: Stephen Sprunk: "Re: use delete to destroy primitive/object types but memory is not freed"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 07 Apr 2004 23:04:58 GMT
> hen you're off-topic, you're off-topic. Don't argue about it, just take
the good advice you are given.
I cant understand why if I am off topic an answer exists in the C-faq. Of
course for the C equivalent of the C++ code I provided in my original post.
Take few steps back and look at the bigger picture please (Dont take it that
I am trying to be "clever" now please)
> Even if the simple substitution you propose actually worked (it doesn't)
int main(){
int *g= malloc(sizeof(int));
*g = 9;
free(g);
printf("%d %d %d %d\n",sizeof(g),sizeof(double),sizeof(*g),*g);
*g = 111;
printf("%d %d %d %d\n",sizeof(g),sizeof(double),sizeof(*g),*g);
return 0; }
The above substitution gives me the same results. Please why dont you try to
explain to me what exactly you mean? This is a typical phainomenon in
newsgroups; people having the knowledge to answer but provide cryptic
answers. If you are not to give a clear answer to my question, its better
not to answer at all!
>there are still differences between C and C++ memory allocation, and
comp.lang.c++ is where you'll get the right >answers, reviewed by the right
people.
Can you please explain to me what is the case in C. This is again a genuine
question. I just want to learn!
- Next message: Joe Wright: "Re: Newbie: Searching for a Projekt to practice C programming"
- Previous message: code_wrong: "Re: how to remove a character from a string"
- In reply to: Alan Balmer: "Re: use delete to destroy primitive/object types but memory is not freed"
- Next in thread: Stephen Sprunk: "Re: use delete to destroy primitive/object types but memory is not freed"
- Reply: Stephen Sprunk: "Re: use delete to destroy primitive/object types but memory is not freed"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|