Path: utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!unmvax!deimos.cis.ksu.edu!uxc!uxc.cso.uiuc.edu!m.cs.uiuc.edu!zweig From: zweig@m.cs.uiuc.edu Newsgroups: gnu.g++.bug Subject: const int *, int * not overloadable Message-ID: <53300013@m.cs.uiuc.edu> Date: 24 May 89 18:59:00 GMT Lines: 36 Nf-ID: #N:m.cs.uiuc.edu:53300013:000:1138 Nf-From: m.cs.uiuc.edu!zweig May 24 13:59:00 1989 It seems like G++ isn't able to tell the difference between a pointer and a const pointer (i.e. pointer to something you're not allowed to change) for purposes of operator overloading. For example: overload f; int f(const int * i) { return (*i); } int f(int * i) { return (*i); } produces the error messages: In function f (int *): tmp.cc:8: conflicting types for `int f (int *)' tmp.cc:3: previous declaration of `int f (const int *)' Thus upshot is that G++ is able to complain about my sending a const int * into a function that takes an int * (since it might let you illegally change what's being pointed at), but there's no way to have a function that does the right thing both for pointers to constant- and pointers to nonconstant values. -Johnny Zweig University of Illinois at Urbana-Champaign Department of Computer Science --------------------------------Disclaimer:------------------------------------ Rule 1: Don't believe everything you read. Rule 2: Don't believe anything you read. Rule 3: There is no Rule 3. -------------------------------------------------------------------------------