🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #225

Re: const T **

#225
From: Andrew Koenig
Date: Thu, 16 Apr 1992 13:33
27 lines
807 bytes
In article <1611@imec.UUCP>, donne@imec.be (Werner Donne) writes:
> int
> main(void)

> {

>   const char **a;
>   char **b;

>   a = b;

>   return 0;

> }

> Why is the assignment illegal?

Because otherwise I could do this:

	const char x = 'x';
	char *p;
	const char **pp = &p;	/* char** -> const char** */
	*pp = &x;		/* p = &x */
	*p = 'y';		/* Oops!! */
-- 
				--Andrew Koenig
				  ark@europa.att.com
Technical Details
Message-ID: <22598@alice.att.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!andante!alice!ark
References: <1611@imec.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!andante!alice!ark
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.std.c
Subject: Re: const T **
Keywords: const
Message-ID: <22598@alice.att.com>
Date: 16 Apr 92 13:33:00 GMT
References: <1611@imec.UUCP>
Organization: AT&T Bell Laboratories, Liberty Corner NJ
Lines: 27