🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #51285

Re: Trouble overloading [] operator.

#51285
From: Peter C. McCluskey
Date: Thu, 10 Jun 1993 01:46
21 lines
1527 bytes
In article <130361@netnews.upenn.edu>, joe@retina.anatomy.upenn.edu (Joe Panico) writes:

|>    unsigned char& operator[](unsigned int i)

|>    a[1] = 1; 
|> 
|>    cerr<< a[1];
|> }
|> 
|> ...compiles without problem. But the output is blank. The values are either
|> not getting into the array or not getting out. Any clues appreciated.

 You are sending a char of value 1 to the output. I wouldn't expect it to produce
a visible result if this is going to a screen. If you expect to see a 1 on the
output, you probably want something like a[1] = '1', or cerr << int(a[1]).

-- 
-----------------------------------------------------------------------------
 Peter McCluskey >> Hofstadter's Law: It always takes longer than you expect,
pcm@cs.brown.edu >> even when you take into account Hofstadter's Law.
-----------------------------------------------------------------------------
Technical Details
Message-ID: <1993Jun10.014632.12078@cs.brown.edu>
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!uunet!brunix!cs.brown.edu!pcm
References: <130361@netnews.upenn.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,65d30effe8ab3429
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-06-09 18:58:14 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!uunet!brunix!cs.brown.edu!pcm
From: pcm@cs.brown.edu (Peter C. McCluskey)
Subject: Re: Trouble overloading [] operator.
Message-ID: <1993Jun10.014632.12078@cs.brown.edu>
Sender: news@cs.brown.edu
Organization: Brown Computer Science Dept.
References:  <130361@netnews.upenn.edu>
Date: Thu, 10 Jun 1993 01:46:32 GMT
Lines: 21