public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* about gcc library
@ 2003-04-08 18:15 Mehdi Khaldi
  2003-04-08 18:57 ` Phil Edwards
  0 siblings, 1 reply; 2+ messages in thread
From: Mehdi Khaldi @ 2003-04-08 18:15 UTC (permalink / raw)
  To: 'gcc@gcc.gnu.org'

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.

Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: about gcc library
  2003-04-08 18:15 about gcc library Mehdi Khaldi
@ 2003-04-08 18:57 ` Phil Edwards
  0 siblings, 0 replies; 2+ messages in thread
From: Phil Edwards @ 2003-04-08 18:57 UTC (permalink / raw)
  To: Mehdi Khaldi; +Cc: 'gcc@gcc.gnu.org'

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-04-08 18:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-08 18:15 about gcc library Mehdi Khaldi
2003-04-08 18:57 ` Phil Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).