Re: End-of-the-week fun
From: Moonlit (alt.spam_at_jupiter.universe)
Date: 11/08/03
- Next message: jblazi: "Accessing members of nested classes"
- Previous message: Rolf Magnus: "Re: ISO C++ forbids casting between pointer-to-function and pointer-to-object"
- In reply to: Dave: "End-of-the-week fun"
- Next in thread: Agent Mulder: "Re: End-of-the-week fun"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 8 Nov 2003 12:44:21 +0100
Hi,
Sswapping the array name and the subscript:
#include <iostream>
using namespace std;
int main()
{
char A[6];
memset( A, 0, sizeof A );
A[5] = 'I' ;
cerr << 5[A] << endl;
return 0;
}
Regards, Ron AF Greve
"Dave" <better_cs_now@yahoo.com> wrote in message
news:vqof847v9ombcc@news.supernews.com...
> TGIF!!!
>
> I don't know if people will be interested in this or not, but if so, we
> might learn a few interesting tidbits!
>
> What are some of the most obscure features of the language you know of?
> Please exclude anything that's not strictly part of the standard, even if
a
> very common extension. This can be in the core language itself or in the
> standard library.
>
> In addition to the obscure feature, a reason for its existence, if known,
> would also be very interesting to hear!
>
> I'll throw out a couple:
>
> 1. Constructor and destructor names may be surrounded by parenthesis.
i.e.
> (~MyClass)( ) {...}
>
> 2. When trying to match an exception to a catch clause, user-defined
> conversions via a one-argument constructor are not used. The short
program
> below prints "Point 2".
>
> Unfortunately, I don't know the reasons for these. Item 1 may not have a
> real compelling reason, but surely item 2 does. I'd be very interested to
> hear the reason for this behavior if anybody knows...
>
> #include <iostream>
>
> using namespace std;
>
> class foo_t
> {
> public:
> foo_t(int) {}
> (~foo_t)() {}
> };
>
> int main()
> {
> try
> {
> throw 45;
> }
> catch(foo_t)
> {
> cout << "Point 1" << endl;
> }
> catch(int)
> {
> cout << "Point 2" << endl;
> }
>
> return 0;
> }
>
>
- Next message: jblazi: "Accessing members of nested classes"
- Previous message: Rolf Magnus: "Re: ISO C++ forbids casting between pointer-to-function and pointer-to-object"
- In reply to: Dave: "End-of-the-week fun"
- Next in thread: Agent Mulder: "Re: End-of-the-week fun"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|