From owner-freebsd-questions@FreeBSD.ORG Wed Mar 2 16:34:33 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5310D16A4CE for ; Wed, 2 Mar 2005 16:34:33 +0000 (GMT) Received: from parrot.aev.net (host29-15.pool8174.interbusiness.it [81.74.15.29]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2BB2E43D46 for ; Wed, 2 Mar 2005 16:34:32 +0000 (GMT) (envelope-from ml@netfence.it) Received: from soth.ventu (adsl-ull-137-5.41-151.net24.it [151.41.5.137]) (authenticated bits=128) by parrot.aev.net (8.13.1/8.13.1) with ESMTP id j22Gp9bl074589 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Mar 2005 17:51:17 +0100 (CET) (envelope-from ml@netfence.it) Received: from netfence.it (xanatar.ventu [10.1.2.6]) (authenticated bits=0) by soth.ventu (8.13.3/8.13.1) with ESMTP id j22GY2Qa020484 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 2 Mar 2005 17:34:02 +0100 (CET) (envelope-from ml@netfence.it) Message-ID: <4225EB19.3070704@netfence.it> Date: Wed, 02 Mar 2005 17:34:33 +0100 From: Andrea Venturoli User-Agent: Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.6) Gecko/20040117 X-Accept-Language: it,en,fr,de MIME-Version: 1.0 To: Florian Hengstberger References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.45 cc: FreeBSD mailinglist Subject: Re: c standard X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Mar 2005 16:34:33 -0000 Florian Hengstberger wrote: We are OT, anyway... > Following is possible with gcc and g++: These are two quite different cases: gcc is normally for C, g++ for C++. Contrary to what many people believe, they are two very different languages. > #include If you are using C++ you should not #include , but #include > double sin(double) > { > return 1; > } > > Why I don't get any warnings like: > sin prevously defined in math.h ... Mainly because it isn't. In math.h (or cmath) sin is only declared, not defined. There might possibly be other reasons: like the fact that in C++, provided you correctly included and not , the standard sin will be in namespace std, not in the global one. > Why is it possible to overwrite the definition of sin, > is this part of the standard? Again, you are providing *a* definition; there is no previous one at this point to override. > Secondly the definition (not declaration) of double sin(double) > misses a variable! You are not missing any variable; you are merely not assigning it any name. > Is this ok, when the variable is not referenced in the code? Exactly. bye av.