This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: about gcc library


On Tue, Apr 08, 2003 at 12:29:17PM -0400, Mehdi Khaldi wrote:
> Hi,
> How to check if a pointer is allocated or not?
> 
> I do "if(p == NULL)". This assumes that the developer did "p = NULL;"
> But if he didn't do that, how can I know if the pointer is allocated or not?
> 
> Example :
> 
> Int *p;
> 
> If(p == NULL)
> 	Printf("P = NULL\n");
> Else
> 	Memset(p, 0, sizeof(int));
> 
> I'd like to know if the pointer is allocated.

That's not how the C language works.  You need a textbook.  This list is
for the development /of/ GCC itself, not how to program in C.

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]