From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20599 invoked by alias); 24 Jan 2003 15:15:09 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 20576 invoked from network); 24 Jan 2003 15:15:07 -0000 Received: from unknown (HELO mta01-svc.ntlworld.com) (62.253.162.41) by 172.16.49.205 with SMTP; 24 Jan 2003 15:15:07 -0000 Received: from trouble ([213.107.164.236]) by mta01-svc.ntlworld.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20030124151506.CYBM22267.mta01-svc.ntlworld.com@trouble> for ; Fri, 24 Jan 2003 15:15:06 +0000 Content-Type: text/plain; charset="us-ascii" From: SA To: gcc-help@gcc.gnu.org Subject: Stupid typedef question / g++ Date: Fri, 24 Jan 2003 15:15:00 -0000 User-Agent: KMail/1.4.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200301241517.27441.bullet.train@ntlworld.com> X-SW-Source: 2003-01/txt/msg00231.txt.bz2 Should this work? // start #include typedef int TYPE1; typedef int TYPE2; void test(TYPE1); void test(TYPE2); void test(TYPE1 in){ printf("Called via type1 %d\n",(int)in); } void test(TYPE2 in){ printf("Called vis type2 %d\n",(int)in); } main(){ test((TYPE1)10); test((TYPE2)20); } // finish Now I expected the typedefs and casts to enable correct function selection but what I got was g++ test.cc test.cc: In function `void test (int)': test.cc:12: redefinition of `void test (int)' test.cc:8: `void test (int)' previously defined here Which is what I would expect if I had used=20 #define TYPE1 int #define TYPE2 int instead? Comments, suggestions? I wanted to use the typedefing to control the functi= on=20 calling for elegance in my program. Thanks SA