www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/01/28/04:57:54

To: djgpp AT sun DOT soe DOT clarkson DOT edu
From: A DOT APPLEYARD AT fs1 DOT mt DOT umist DOT ac DOT uk
Date: 28 Jan 93 08:55:14 GMT
Subject: (1) addresses wanted; (2) '...' argument funny

  (1) Please tell me the email addresses to contact re (a) bugs in GCC, (b)
suggestions and queries re the C and C++ languages.

  (2) In Gnu C++, as is well known:-
  If the last formal parameter in a function type declaration is '...', the
corresponding actual parameter can be zero or more parameters of any sort,
e.g. 'int zxcvbnm(int i,...);'
  If a class type, say 'class qwerty{ . . . . . .};', has a member function of
type 'qwerty::qwerty(&qwerty Q){. . . . . . .};', such a function tells GCC
how values of type 'qwerty' are to be copied. I hereinafter call this sort of
member function function a 'userdefined copier'. Otherwise any required
copying of 'qwerty' type values is binary as in old-style C structs.

  **** I found that in Gnu C++ the '...' argument specifier will not accept
values of class types of classes that have a userdefined copier member
function. Thus e.g. after these declarations:-

  class cat{public:int q,a,z;};
  class dog{public:int q,a,z; dog{dog&w){q=w.q; a=w.a; z=w.q+w.a;};};
  void calculate(int i,...); cat miaow; dog wuff;

  'calculate(4,miaow);' is accepted, but 'calculate(4,wuff);' is refused.
  Is this restriction intended?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019