Thread Closed

C++ Quiz starts here...>

 
Share Thread Thread Tools
Feb14-07, 08:03 PM   #18
 

C++ Quiz starts here...>


Quote by Hurkyl View Post
At the very least, you missed the comma operator. (Does new, new[], delete, and delete[] count too? Hrm)
The default comma operator is just a sequence operator, that does absolutely nothing. If you are going to count it as an "implicit function", so does the add (+), increment (++), multiply (*), etc. :)

I don't think new and delete count as "implicit"; I consider them built-in, just like the operators on primitive types. In fact, the compiler won't generate any code, it will just call the implementation provided by the standard library - that's why you can replace them through <new> (as the linkage of the standard library happens after the symbols were resolved); so new and delete are as implicit as malloc and free.

BTW, right after posting, I checked my copy of the standard to make sure, and it also lists the implicit functions the same way I did. So anything beyond this is a matter of interpretation of what "THE SPECIAL FUNCTIONS A C++ COMPILER CAN CREATE IMPLICITY" means.
Feb14-07, 11:33 PM   #19
 
Recognitions:
Gold Membership Gold Member
Science Advisor Science Advisor
Retired Staff Staff Emeritus
Quote by DanielKO View Post
The default comma operator is just a sequence operator, that does absolutely nothing. If you are going to count it as an "implicit function", so does the add (+), increment (++), multiply (*), etc. :)
If x and y are objects of your class, you cannot write x + y unless you explicitly define operator+, and similarly for the other functions you mentioned. On the other hand, you can write x, y without providing an explicit definition of operator,.
Feb15-07, 12:11 AM   #20
 
Quote by Hurkyl View Post
On the other hand, you can write x, y without providing an explicit definition of operator,.
Because the plain comma operator is exactly the same present in the C language: it does nothing (other than separating two expressions by a sequence point, and evaluating to the second expression). Maybe you would like to consider the (void) conversion operator as "implicitly created by the compiler"? After all, you can write (void)x; without providing an explicit definition.

You are considering a C language construct as an "implicitly created function".
Thread Closed
Thread Tools


Similar Threads for: C++ Quiz starts here...>
Thread Forum Replies
Where does quantum gravity starts ? Special & General Relativity 16
Pull of Gravity.......Where it starts? General Astronomy 3
Physics starts with Archimedes! General Physics 1