Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 23:54

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C++ const nightmare

Discussion on C++ const nightmare within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2007
Posts: 62
Received Thanks: 17
Exclamation C++ const nightmare

Hello eveyone,

could someone of C++ profs. out here explain me following method declaration? Just got a bit confused

Code:
const int* const SampleMethod(const int* const&) const;
Best regards!

Demon-777
Demon-777 is offline  
Old 10/18/2011, 16:40   #2
 
elite*gold: 115
Join Date: Oct 2007
Posts: 9,390
Received Thanks: 12,345
That declaration doesn't seem to make any sense to me.

Code:
const int* const SampleMethod(const int*);
This would be a function taking a pointer to a const int as argument and returning a const int-pointer to a const int.


Edit:
Code:
const int* const SampleMethod(const int* const&);
I'm not sure, but I think this is the same as above with the argument being a reference to a const pointer to a const int. My compiler doesn't accept the declaration with your trailing const though.

Edit 2:
The trailing const in your declaration makes sense when it's a method of a class. It means that the method is not allowed to alter any members of its class.
ms​ is offline  
Thanks
1 User
Old 10/18/2011, 16:52   #3
 
elite*gold: 0
Join Date: Nov 2007
Posts: 62
Received Thanks: 17
Quote:
Originally Posted by Metin2Spieler97 View Post
This would be a function taking a pointer to a const int as argument and returning a const int-pointer to a const int.
oh now I see! It's not for compilation purposes. Just learning how to use this const stuff and trying to understand all this magic C++ thingy!

Thank you through!

PS. got it from , just scroll to the bottom where you'll see "Messier Still - in the Object Oriented Programming" :P That make me confused.
Demon-777 is offline  
Reply


Similar Threads Similar Threads
[Release]Meteor Const Dmg
12/18/2011 - General Gaming Discussion - 280 Replies
Hay this is a small hack for guardien :D 1. start the exe 2. after u login you can put hack on and off how often you want 3. do Big Meteor and have fun Works 32 & 64 bit Lazeboy
const variables VS enumerators
09/24/2011 - CO2 Private Server - 8 Replies
What is better to use? It's Conquer Related, because it's for my source. Currently I have been using enumerators, except for packetids and mapids they are const variables.
S> 130-131 arc/arc Const>Gemini
01/11/2011 - Conquer Online 2 Trading - 0 Replies
Selling Archer 130-131 with sup gears and bow lvl 130+4 2sdg post offers...
[HELP] Adding a new const ushort.
05/29/2009 - CO2 Private Server - 0 Replies
YEa yea this might be noobish but i dont understand this part if someone can Show me what it looks like i will be able to understand it im trying to add a Here what it says 6) In Networking/Packets/Data Packet.cs add a new const ushort. Portal = 85, i tryed and it dont seem to work lol someone give me a hand im useing extremely-basic source
ress const loom und login macro
07/19/2007 - General Gaming Discussion - 14 Replies
So hier is mal ne macro sammung mit 4 unterschiedlichen macros 1 Acclogin Macro: wenn man viele accs hatt und für alle andere namen und passwörtet dann nervt das tippen beim umlogen. Also einfach und dem acclogin macro Namen und Passwort von dem Acc eingeben und schon Tipt das macro die acc daten für euch in das loginfenster 2 Ress Macro: einfach Resstool und Blueprint in das prozessor fenster , Mauszeiger über start und los gehts :) (je nach tl müsst ihr im macro die wartezeit zwichen...



All times are GMT +1. The time now is 23:55.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.