From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19214 invoked by alias); 8 Aug 2003 04:46:48 -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 19202 invoked from network); 8 Aug 2003 04:46:47 -0000 Received: from unknown (HELO lifesupport.shutdown.com) (66.92.48.59) by sources.redhat.com with SMTP; 8 Aug 2003 04:46:47 -0000 Received: (from llewelly@localhost) by lifesupport.shutdown.com (8.11.2/8.11.2) id h784g0M09139; Thu, 7 Aug 2003 21:42:00 -0700 (PDT) To: Wei Qin Cc: gcc-help@gcc.gnu.org Subject: Re: Proper and portable ways using manipulator References: From: LLeweLLyn Reese Date: Fri, 08 Aug 2003 04:46:00 -0000 In-Reply-To: Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-08/txt/msg00069.txt.bz2 Wei Qin writes: > Hi, > I used some manipulators in the form of > > #include > #include Try: #include instead. (Note: I don't have 2.96 availible to test.) > > int main () { > > std::cout << std::showbase << std::hex << 100 << std::endl; > } > > This compiles fine with g++ 3.x. However, it fails on g++ 2.96 > since it cannot find ios. When I remove ios, it cannot find showbase. Then > I change std::showbase to std::ios::showbase, but this showbase is not a > manipulator any more. As a result the program outputs 8064 instead of > 0x64. > So my question is: Is there any good coding practice to make sure > that the same code compiles for both and works as intended? Thanks. Compile every change with both compilers.