Thread View: gnu.g++.bug
1 messages
1 total messages
Started by "Douglas C. Schmidt"
Mon, 31 Oct 1988 17:55
g++ too permissive with const * parameters
Author: "Douglas C. Schmidt"
Date: Mon, 31 Oct 1988 17:55
Date: Mon, 31 Oct 1988 17:55
36 lines
1419 bytes
1419 bytes
Hi,
The following program demonstrates an attempt to circumvent the const
specifier:
----------------------------------------
void foo ( const int *f ) {
int *foo = f;
*foo = 100; // defeat const!
}
main () {
int foobar;
int *bar = &foobar;
foo ( bar );
}
----------------------------------------
g++ doesn't complain about this, whereas CC retorts:
----------------------------------------
CC test.C:
"test.C", line 6: error: bad initializer type const int * for foo ( int * expected)
1 error
----------------------------------------
This seems like a reasonable approach, no?
Doug
------------------------------
schmidt@bonnie.ics.uci.edu (ARPA) | Per me si va nella cita dolente.
| Per me si va nell' etterno dolore.
| Per me si va tra la perduta gente.
| Lasciate ogni speranza voi ch' entrate.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads