🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #40

g++2.2.2 bug with `? : ' operator?

#40
From: Joachim Schnitter
Date: Wed, 04 Nov 1992 17:15
34 lines
1478 bytes
Is it true that this is not allowed in C++ (g++)?

	#include <stdio.h>

	main()
	{
	  const char* str = "init";

	  str = ( *str == '\0' ) ? 
				"new":
				 str ;		/* <- problematic line */
	  printf( "%s\n", str );
	}

g++2.2.2 ($ g++ -o jo jo.cc) complains "assignment between incompatible
pointer types". This works

	str = str;

I found this kind of stuff in the InterViews package from Stanford (part
of the X11R5 contrib tape).

Should that code work?

-Joachim
--
______________________________________________________________________
Joachim Schnitter                           Tel.: +49 (61 51) 16-53 97
Techn. Hochschule Darmstadt                 Fax : +49 (61 51) 16-42 98
Physikalische Chemie I
Petersenstr. 20
D-6100 Darmstadt   
Germany                        E-Mail: josch@pc.chemie.th-darmstadt.de
______________________________________________________________________
Technical Details
Message-ID: <JOSCH.92Nov4171538@ws06.pc.chemie.th-darmstadt.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ws06.pc.chemie.th-darmstadt.de!josch

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ws06.pc.chemie.th-darmstadt.de!josch
From: josch@ws06.pc.chemie.th-darmstadt.de (Joachim Schnitter)
Subject: g++2.2.2 bug with `? : ' operator?
Message-ID: <JOSCH.92Nov4171538@ws06.pc.chemie.th-darmstadt.de>
Sender: gnulists@ai.mit.edu
Organization: Technische Hochschule Darmstadt, D-6100 Darmstadt
Distribution: gnu
Date: Wed, 4 Nov 1992 17:15:37 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 36