From owner-freebsd-chat Sun Aug 29 16:19:36 1999 Delivered-To: freebsd-chat@freebsd.org Received: from sand5.global.net.uk (sand5.global.net.uk [194.126.80.249]) by hub.freebsd.org (Postfix) with ESMTP id 8F07115246 for ; Sun, 29 Aug 1999 16:19:31 -0700 (PDT) (envelope-from mark@globalnet.co.uk) Received: from pb8s10a06.client.global.net.uk ([195.147.218.185] helo=marder-1.) by sand5.global.net.uk with esmtp (Exim 2.05 #1) id 11LEEU-0004lR-00 for chat@freebsd.org; Mon, 30 Aug 1999 00:19:30 +0100 Received: (from mark@localhost) by marder-1. (8.9.2/8.8.8) id AAA00477 for chat@freebsd.org; Mon, 30 Aug 1999 00:12:02 +0100 (BST) (envelope-from mark) Date: Mon, 30 Aug 1999 00:12:01 +0100 From: Mark Ovens To: chat@freebsd.org Subject: Correct casting in ANSI C Message-ID: <19990830001201.C265@marder-1> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i Organization: Total lack of Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org To achieve *strict* ANSI compliance, what is the correct way to use cast(s) in the following code. gcc doesn't complain, even with ``-Wall'', but Sun's ANSI C compiler gives a warning like "the semantics of SCONV change in ANSI C; use an explicit cast". Do I need to cast each int (& the literal 1000), or just cast the whole expression? int i = 123, j = 57, k = 500; double d; d = i / j + k / 1000; -- STATE-OF-THE-ART: Any computer you can't afford. OBSOLETE: Any computer you own. ________________________________________________________________ FreeBSD - The Power To Serve http://www.freebsd.org My Webpage http://ukug.uk.freebsd.org/~mark/ mailto:mark@ukug.uk.freebsd.org http://www.radan.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message