This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: typedef
- To: Martin Strauss <mys at faveve dot uni-stuttgart dot de>
- Subject: Re: typedef
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 13 Mar 2001 02:10:15 -0300
- Cc: gcc-help at gcc dot gnu dot org
- Organization: GCC Team, Red Hat
- References: <20010312233232.A32756@faveve.uni-stuttgart.de>
On Mar 12, 2001, Martin Strauss <mys@faveve.uni-stuttgart.de> wrote:
> The following program compiles usually without reporting a warning ...
> but it should because of a kind of type missmatch :
> */
> typedef int value_t;
> typedef int counter_t;
> int main(){
> value_t v=0;
> counter_t c=0;
> v=c; /* makes no sense */
Nope. In C, typedefs are type *aliases*, not unrelated types.
You might play with int-like classes in C++; that might give you
increased type safety.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me