But reference never creates a new variable, it is an alias to the same memory location, if you see the output of the code, you will see "i" and "j" have the same address. ok, if the following statement creates a new variable, is there any way to get the address of that variable? i tried to print &(int&)i, it still gives the same address as "i" and "j"; int& j = (int&)i;
Aabid
Posts
-
reference to const int -
reference to const inti know that, but i was trying to understand the previous behavior and that is still a mystery!
-
reference to const intVS 2010, VC++.
-
reference to const intvoid main() { const int i = 10; int& j = (int&)i; cout << "i= " << i << endl; cout << "j= " << j << endl; cout << "&i= " << &i << endl; cout << "&j= " << &j << endl; j++; cout << "j= " << j << endl; cout << "i= " << i << endl; } //output i= 10 j= 10 &i= 0012FF60 &j= 0012FF60 j= 11 i= 10 Hi, the code declares a const integer and a reference to it. incrementing a reference adds 1 to j and outputs as 11, that is fine. i was expecting "i" to get modified, since "i" and "j", both having a same memory address, as i print "i", it outputs 10 (or compiler should not allow to increment j). i could not understand the behavior. Could anybody explains me what is going on behind the scene? regards Abid
-
Remove Features/components from Windows 7 [modified]it is general discussion. or if there is any API or any way in C, i can go for that too.
-
Remove Features/components from Windows 7 [modified]Hello All, I want to delete "Games" from windows 7. i.e. delete all the installation files from the system, so that if in case user turns the Game feature ON, OS should ask for some media like DVD to copy those installation files. Turn the Feature OFF & ON does not achieve my target. i have to remove files to make more space available. NOTE: By default windows 7 contains all the files within its local storage ie HDD Any suggestion how to approach the problem. Thanks!
modified on Thursday, September 23, 2010 5:26 AM
-
NTLM AUTH for SMTP serverGood day Friends! Here comes a new challenge! Need to discuss whether it is right or what? My problem is that the challenge sent by the server should be 8 bytes as i read from the documentation. As i decode the hash send by the server and Extract Challenge from it, it gives me only 7 characters including null character. should i generate the response by using that 7 byte challenge or somewhere i am wrong. is the challenge must be 8 bytes? In short my question is:: can a challenge be less than 8 bytes?
-
Compilation errorsyes i tried to find out the instructions to compile but i didn`t find any info regarding compilation.
-
Compilation errorsok.. i need to compile the source code.
-
Compilation errorshi i do not understand what you want to say? can u explain little better
-
Compilation errorshi friends, i am using Visual studio 6.0, Windows. i dowload an opensource project "wput" :: Wput is a command-line ftp-client that looks like wget but instead of downloading, uploads files or whole directories to remote ftp-servers. http://wput.sourceforge.net/[^] as i compile the project i got tons of errors, ftp-ls.c(40) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory unistd.h is not present anywhere in my system. Any suggestions!
-
Can We make ContextMenu as "sytem modal"Hi Can Context menu be system modal, so that if any tool tip appears,it should display behind my context menu not above it... Thanks
-
ContextMenu with icons diplayed on right clicking the tray iconHello all i made an application in which i had to display icons next to menu item and i did it successfully and it works fine in windows 2000, vista, 7 but in case of windows 2003 and Xp, there lies a problem as if in case any tool tip is displayed over my context menu, the menu item over which the tool tip lies that menu item`s icon (Only Icon And Not The Text)gets erased...... Can Anybody Suggest me where exactly the problem lies Any help is highly appreciated Note :: It happens Only In Case Of Win 2003 and Win. Xp
-
exe not works on Vista 32 bithave u consulted Michael Schubert
-
exe not works on Vista 32 bithello friends i made an application, it works fine in all OS`s except vista 32 bit. i believe i am missing some macro and i don`t know what macro i should define in order to run my application on vista Any suggestion is greatly appreciated Thanks
-
Simple Menus That Display Icons in Win32 API (No MFC)Hi david can u guide me how to convert this function to Win32 API, ie how can i handle this function as message void CMainFrame::OnInitMenu(CMenu* pMenu) { #if _MFC_VER < 0x0800 #undef __FUNCTION__ #define __FUNCTION__ "OnInitMenu()" #endif // _MFC_VER < 0x0800 AfxTrace(_T(__FUNCTION__) _T(": %#0x\n"), pMenu->GetSafeHmenu()); MENUITEMINFO minfo; minfo.cbSize = sizeof(minfo); for (UINT pos=0; pos<pMenu->GetMenuItemCount(); pos++) { minfo.fMask = MIIM_FTYPE | MIIM_ID; pMenu->GetMenuItemInfo(pos, &minfo, TRUE); HICON hIcon = GetIconForItem(minfo.wID); if (hIcon && !(minfo.fType & MFT_OWNERDRAW)) { AfxTrace(_T("replace for id=%#0x\n"), minfo.wID); minfo.fMask = MIIM_FTYPE | MIIM_BITMAP; minfo.hbmpItem = HBMMENU_CALLBACK; minfo.fType = MFT_STRING; ::SetMenuItemInfo(pMenu->GetSafeHmenu(), pos, TRUE, &minfo); } else AfxTrace(_T("keep for id=%#0x\n"), minfo.wID); // ::DestroyIcon(hIcon); // we use LR_SHARED instead } } We Have To Conert it into case WM_INITMENU:
-
Advance tolpic in vc6your problem is too brief can u explain it little more... what type of programs you want to make in VC++6.
-
Simple Menus That Display Icons in Win32 API (No MFC)Hello Friends my task is to append icons to menu (ie .ico), it is very easy to add bmp file to menu, but in order to need transparency i have to use icons only not bmps. There are lots of programs for this in MFC , but i need to do it in Win32 API using VC++ Any help is greatly appreciated
-
How to build .mc fileThanks Garth J Lancaster!!! it was a great article. I got my work Done ... Thanks
-
How to build .mc fileHello All I have a file as "Sample.mc" copied from the below link..... http://msdn.microsoft.com/en-us/library/bb540476(VS.85).aspx[^] These r some rules mentioned on the above page how to build this file, Build the message DLL from Sample.mc using the following steps: 1. mc -U sample.mc 2. rc -r sample.rc 3. link -dll -noentry -out:sample.dll sample.res but i want to know where and how to apply these rules... i am using Vs 2005 VC++(Win32 API).... Any suggestion is highly appreciated Thanks