Topic: <none>


Author: "Larry West" <lwest@socket.net>
Date: 1999/11/18
Raw View
I had thought that this was valid C++ code according to the standard,
yet it does not compile in either MSVC++6.0 or C++Builder4.  Seems that
the overloaded function is somehow hiding the original function, even
though they have different signatures (but the same name).  Aren't you
supposed to be able to use a derived class in any way its base class can
be used?  Is there something in the standard I am missing, or are both
these compilers non compliant in reporting an error.

class Base
{
public:
    void func1(int a){}
};

class Derived : public Base
{
public:
    void func1(int b,int c){}
};

int
main(int argc,char** argv)
{
    Derived d;
    d.func1(3); //ERROR: 'func1': function does not take 1 parameters
    return 0;
}


Just qualify the call, i.e.

d.Base::func1(3);

West

[ moderator's note: html attachment deleted. Please do not post html. -sdc ]



[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Mike Schilling <mikes@forte.com>
Date: 1999/09/04
Raw View
Barry Margolin wrote:
>
> In article <MPG.123a08a59ef59b1b9896db@news.nabs.net>,
> Jeff Rife  <jrife-news@nabs.net> wrote:
> >There are 3 cases that a conforming compiler could do:
> >
> >1. Aligned correctly for the processor and access is optimum
> >2. Aligned incorrectly for the processor, and access is slow, but works
> >3. Aligned incorrectly for the processor, and attempted access throws
> >   a hardware exception, which the compiler supplies a handler for that
> >   does something to make the data accessible
>
> One problem with #3 is that it make "fix" things that it shouldn't.  Some
> misaligned accesses are due to use of pointers that were not initialized
> properly.  Of course, the language doesn't require the system to catch
> these; doing an incorrect fixup is just as conforming as crashing the
> program.
>
> Also, it should be noted that this is only applicable to processors that
> signal a hardware exception on unaligned accesses.  I don't know if any
> extent processors do it, but it's also conceivable that a processor would
> simply perform the access incorrectly.  E.g. if an operation requires
> 4-byte alignment, it could simply ignore the two low-order bits when
> interpreting the operand address.  Only technique #2 can be used to work
> around this.
>

IIRC, the F11 processer (used in PDP 11/23 and 11/24) had this behavior.
If the low bit was set in the address operand of a word instruction, it was
silently ignored.  On other PDP 11s this more sensibly results in a trap.
-----------------------------------------------------------------------
Mike Schilling (mikes@forte.com) (510)869-3474
Forte Software, Inc.

    I always do my best to be just like I am
    But everybody wants you to be just like them.
       Bob Dylan


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: 1JCR7732@ibm.mtsac.edu
Date: Fri, 03 Jun 94 12:38:10 PDT
Raw View
I hope this is the right place to post.  But here goes.  I have to run a tape
drive that is SCSI.  Now, at first I was going to use Symantek's ThinkC for the
Macintosh because SCSI is standard and there is some SCSI functions that allow
you to send messages to the device and receive.  Well, I am a Borland man, and
a PC man, and I would rather not use the Macintosh.  I have Borand 4.0 C++ here
and I have a simple question that the tech support want a million dollars to
answer.  Is there any SCSI functions in the Borland C++ 4.0 library??  If so,
can you tell me where they are and what their name is??  What include files do
use?
Some tell me that in IBM, SCSI is not standard and so there would be no
funtions.  Please help me.  I hate to use that Macintosh.  Well here's what I
have to do... I have a 10 tape cartridge player.  I have the manual for it and
I know the addresses of each of the devices.  I have to eject one tape when
it's finished and put it back into its slot.  Any advice will be welcome. :)
Post or Email

Joseph Romero 1jcr7732@ibm.mtsac.edu
You can never learn too much . . .