Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!infopiz!lupine!rfg From: rfg@NCD.COM (Ron Guilmette) Newsgroups: comp.lang.c++ Subject: Re: Use of Ellipsis on c++ Message-ID: <5131@lupine.NCD.COM> Date: 19 Apr 91 15:59:01 GMT References: <1991Apr18.203147.19510@bingvaxu.cc.binghamton.edu> Organization: Network Computing Devices, Inc., Mt. View, CA Lines: 53 In article <1991Apr18.203147.19510@bingvaxu.cc.binghamton.edu> consp06@bingsuns.cc.binghamton.edu (Robert Konigsberg) writes: >I'm writing my first c++ Class - Matrices (Ooooohh) > >The Constructor is defined as follows: > >void Matrix(unsigned xv=1, yv=1, ...) {Alloc(xv,yv); SetZero(); > Values(...);}; > >See? It initializes the size in Alloc. It sets all the values to >zero in SetZero, and then takes the values from ... in inserts them >into the matrix... You have apparently uncovered an interesting bug in your C++ language processor (which I suspect is cfront, but I'm not sure). An ellipsis (i.e. `...') is *not*, I repeat *not* a variable nor is it anything even remotely like a variable. Thus, it is also not a formal parameter and it should be illegal to try to "pass" an ellipsis to another function. The ellipsis is a special token whose only legitimate use is as a way of indicating that a given function may (or may not) take additional parameters (beyond those listed to the left of the ellipsis), all of which have unspecified types. In order to access these additional *actual* parameter values (if any) you must use the va_start, va_arg, and va_end macros. (See your local manpage under `stdarg' or your ANSI C standard document.) So the long and the short of it is that you have done something (i.e. trying to "pass" an ellipsis) which is illegal in both ANSI C and in C++. The fact that your C++ language processor let you get away with this indicates that there is bug in that product. (Note that some C compilers produced by AT&T have an interesting implementation of the va_start macro which assumes that the underlying C compiler *does* allow one to say: &... within the body of a function. I suspect that the ability to refer to `...' within the body of a function may have been carried over into other AT&T products, but I have no way of knowing. Cfront 2.1 properly complains if you try to "pass" an ellipsis.) So what C++ language processor *are* you using? -- // Ron ("Loose Cannon") Guilmette // Internet: rfg@ncd.com uucp: ...uunet!lupine!rfg // New motto: If it ain't broke, try using a bigger hammer.