ahuttune@niksula.hut.fi (Ari Juhani Huttunen) (08/29/90)
I found something strange in TC++ documentation recently. The keywords and operatators mentioned in the header of this article are mentioned in "Turbo C++ Programmer's Guide", but NOWHERE is there any explanation for them.. At least I couldn't find any. So, what are operators .* ->* and keywords catch template ? -- ___ ___ ___ ___ ___ ___ ___ ___ ___ __I I__I I__I I__I I__I I__I I__I I__I I__I I Thank you Ari Huttunen (ahuttune@niksula.hut.fi) I for not smoking! ____________________________________________I <Robocop>
hopper@ux.acs.umn.edu (hopper) (08/29/90)
In article <AHUTTUNE.90Aug28211112@silver-surfer.hut.fi> ahuttune@niksula.hut.fi (Ari Juhani Huttunen) writes: > >I found something strange in TC++ documentation recently. The keywords >and operatators mentioned in the header of this article are mentioned >in "Turbo C++ Programmer's Guide", but NOWHERE is there any explanation >for them.. At least I couldn't find any. > >So, what are operators > .* > ->* >and keywords > catch > template I've never heard of those keywords, but the operators are documented in the Turbo C++ online manual. They may be in the paper manual too, but I don't look at that a lot. It doesn't provide a complete enough definition for me. The operators .* and ->* are pointer-to-member referencing operators. C++ has provided a way to get offset pointers into a class, the best way to explain it is an example. (Note: This was gotten from 'Programming In C++' by Stephen C. Dewhurst & Kathy T. Stark, part of the Prentice Hall Software Series, a book I kinda like.) class Node { public: int code; int num; void print(); void report(); }; SomeSillyFunction(Node &n, int Node::*pi) { *np = &n; int i, j; i = n.*pi; j = np->*pi; } main() { Node n; SomeSillyFunction(n, &(Node::num)); // Both i & j get set to n.num SomeSillyFunction(n, &(Node::code)); // Both i & j get set to n.code } I presume that this construct would be most useful when offset pointers to functions. It is the only reliable way to get the address of a member function, since they have to have a this pointer passed to them. Have fun, UUCP: rutgers!umn-cs!ux.acs.umn.edu!hopper (Eric Hopper) __ /) /**********************/ / ') // * I went insane to * / / ______ ____ o // __. __ o ____. . _ * preserve my sanity * (__/ / / / <_/ / <_<__//__(_/|_/ (_<_(_) (_/_/_)_ * for later. * Internet: /> * -- Ford Prefect * hopper@ux.acs.umn.edu </ #include <disclaimer.h> /**********************/ -- -- Nils_McCarthy mtymp01@ux.acs.umn.edu rutgers!umn-cs!ux.acs.umn.edu!mtymp01 "The wonders of modern technology..." :-) :-) :-)
wlp@calmasd.Prime.COM (Walter Peterson) (08/29/90)
In article <2151@ux.acs.umn.edu> hopper@ux.acs.umn.edu (Eric Hopper) writes: >In article <AHUTTUNE.90Aug28211112@silver-surfer.hut.fi> ahuttune@niksula.hut.fi (Ari Juhani Huttunen) writes: >> >>I found something strange in TC++ documentation recently. The keywords >>and operatators mentioned in the header of this article are mentioned >>in "Turbo C++ Programmer's Guide", but NOWHERE is there any explanation >>for them.. At least I couldn't find any. >> >>So, what are operators >> .* >> ->* >>and keywords >> catch >> template > > I've never heard of those keywords, but the operators are documented >in the Turbo C++ online manual. ... The keyword "catch" is for use by the C++ exception handling, which has not yet been put into the language. The keyword "template" is for use by the C++ parameterized types declarations ( somewhat like Ada generics ), which have also not yet been put into the language. Stroustrup has written several papers on both of these features and AT&T recently entered into an agreement with Object Design, Inc. to use their implementation of parameterized types in future releases of cfront. So we might be seeing parameterized types fairly soon. These keywords are in the language already, because the high-level design of both of these features has been nailed down pretty well, its just the implementation that is lagging a bit. -- "Exploring the consensual hallucination of cyberspace." Walt Peterson. wlp@calmasd.Prime.COM "The opinions expressed here are my own."
steve@taumet.com (Stephen Clamage) (08/29/90)
ahuttune@niksula.hut.fi (Ari Juhani Huttunen) writes: >I found something strange in TC++ documentation recently. The keywords >... mentioned in the header of this article are mentioned >in "Turbo C++ Programmer's Guide", but NOWHERE is there any explanation >for them.. At least I couldn't find any. >So, what are ... keywords > catch > template A proposed extension to C++ involves Templates (parameterized types) which will be in a future definition of the language. "template" will probably be the keyword introducing this feature. Exception handling is another proposed extension, for which "catch" will probably be a keyword. It now appears that "throw" will also be keyword. At the moment, none of these words is part of the language, but for future compatibility it would be a good idea to avoid their use as identifiers. -- Steve Clamage, TauMetric Corp, steve@taumet.com
shankar@hpclscu.HP.COM (Shankar Unni) (08/30/90)
> and keywords > catch > template These are reserved by the language for future use (exception handling and parameterized types), and are supposed to be documented as such. ----- Shankar Unni E-Mail: Hewlett-Packard California Language Lab. Internet: shankar@hpda.hp.com Phone : (408) 447-5797 UUCP: ...!hplabs!hpda!shankar