|
No it won't, except by chance of register values. If you want a function to return a value in C/C++, you have to use the keyword return .
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
hey,
don't confuse an inline woth a macro. An inline functions stays a function. when the docs say the compiler will extend the inline, first, it is not an obligation (it does it only if the function is not very complicated), second, it does NOT copy the content of the function at the calling, it makes an adaptation.
the function :
<font style="color:blue;">inline int</font> my_sum_func(<font style="color:blue;">int </font>iParam1, <font style="color:blue;">int</font> iParam2) {
return (iParam1 + iParam2); <font style="color:green;">
}
the calling :
<font style="color:blue;">void</font> main (<font style="color:blue;">void</font>) {
<font style="color:blue;">int</font> iSumResult = my_sum_func(5, 3);
}
<font style="color:green;">
the compiler will extend such code like this :
<font style="color:blue;">void</font> main (<font style="color:blue;">void</font>) {
<font style="color:blue;">int</font> iSumResult = (5 + 3);
}
are you now convinced ?
!!! : Don't forget : the compiler extends inlines functions only if it can, that is not an obligation to it !
TOXCCT >>> GEII power
|
|
|
|
|
I have a application that inserts a CString and CList in a std::map;
In .h file
typedef CList<csplfiletsinfo*, csplfiletsinfo*=""> SplFileTSInfoList;
typedef std::map<cstring, splfiletsinfolist*=""> tagSplFileInfoMap;
tagSplFileInfoMap m_SplFileInfoMap;
In .cpp file
//A vrialble of type SplFileTSInfoList
SplFileTSInfoList *l_SplFileTSInfoList;
//Insert the Key and the List in to the Map
m_SplFileInfoMap.insert(f_crstrUserID,l_SplFileTSInfoList);
But when I compile this I get an error.
error C2664: 'std::_Tree<_Traits>::iterator std::_Tree<_Traits>::insert(std::_Tree<_Traits>::iterator,const std::_Tree<_Traits>::value_type &)' : cannot convert parameter 1 from 'CString' to 'std::_Tree<_Traits>::iterator'
with
[
_Traits=std::_Tmap_traits<cstring,clist<csplfiletsinfo *,csplfiletsinfo="" *=""> *,std::less<cstring>,std::allocator<std::pair<const cstring,clist<csplfiletsinfo="" *,csplfiletsinfo="" *=""> *>>,false>
]
and
[
_Traits=std::_Tmap_traits<cstring,clist<csplfiletsinfo *,csplfiletsinfo="" *=""> *,std::less<cstring>,std::allocator<std::pair<const cstring,clist<csplfiletsinfo="" *,csplfiletsinfo="" *=""> *>>,false>
]
|
|
|
|
|
Well, I guess you would like to map a string to a CList.
If yes, use this:
<br />
typedef CList SplFileTSInfoList;<br />
typedef std::map< CString, SplFileTSInfoList > tagSplFileInfoMap;<br />
<br />
...<br />
<br />
m_SplFileInfoMap.insert( tagSplFileInfoMap::value_type( f_crstrUserID, l_SplFileTSInfoList ) );<br />
<br />
Jens
|
|
|
|
|
Your error is because you aren't calling insert properly. I would guess (though it's hard to tell from your code) that you will want to try
<br />
m_SplFileInfoMap.insert(make_pair(f_crstrUserID, l_SplFileTSInfoList));<br />
--Dean
|
|
|
|
|
I have a application that inserts a CString and CList in a std::map;
In .h file
typedef CList<csplfiletsinfo*, csplfiletsinfo*=""> SplFileTSInfoList;
typedef std::map<cstring, splfiletsinfolist*=""> tagSplFileInfoMap;
tagSplFileInfoMap m_SplFileInfoMap;
In .cpp file
//A vrialble of type SplFileTSInfoList
SplFileTSInfoList *l_SplFileTSInfoList;
//Insert the Key and the List in to the Map
m_SplFileInfoMap.insert(f_crstrUserID,l_SplFileTSInfoList);
But when I compile this I get an error.
error C2664: 'std::_Tree<_Traits>::iterator std::_Tree<_Traits>::insert(std::_Tree<_Traits>::iterator,const std::_Tree<_Traits>::value_type &)' : cannot convert parameter 1 from 'CString' to 'std::_Tree<_Traits>::iterator'
with
[
_Traits=std::_Tmap_traits<cstring,clist<csplfiletsinfo *,csplfiletsinfo="" *=""> *,std::less<cstring>,std::allocator<std::pair<const cstring,clist<csplfiletsinfo="" *,csplfiletsinfo="" *=""> *>>,false>
]
and
[
_Traits=std::_Tmap_traits<cstring,clist<csplfiletsinfo *,csplfiletsinfo="" *=""> *,std::less<cstring>,std::allocator<std::pair<const cstring,clist<csplfiletsinfo="" *,csplfiletsinfo="" *=""> *>>,false>
]
|
|
|
|
|
ykutanoor wrote:
m_SplFileInfoMap.insert(f_crstrUserID,l_SplFileTSInfoList);
Try
m_SplFileInfoMap.insert(std::make_pair(f_crstrUserID,l_SplFileTSInfoList));
There are other idioms for inserting into maps, I suggest reading around a bit.
Paul
|
|
|
|
|
I have a application that inserts a CString and CList in a std::map;
In .h file
typedef CList<csplfiletsinfo*, csplfiletsinfo*=""> SplFileTSInfoList;
typedef std::map<cstring, splfiletsinfolist*=""> tagSplFileInfoMap;
In .cpp file
//A vrialble of type SplFileTSInfoList
SplFileTSInfoList *l_SplFileTSInfoList;
//Insert the Key and the List in to the Map
m_SplFileInfoMap.insert(f_crstrUserID,l_SplFileTSInfoList);
But when I compile this I get an error.
error C2664: 'std::_Tree<_Traits>::iterator std::_Tree<_Traits>::insert(std::_Tree<_Traits>::iterator,const std::_Tree<_Traits>::value_type &)' : cannot convert parameter 1 from 'CString' to 'std::_Tree<_Traits>::iterator'
with
[
_Traits=std::_Tmap_traits<cstring,clist<csplfiletsinfo *,csplfiletsinfo="" *=""> *,std::less<cstring>,std::allocator<std::pair<const cstring,clist<csplfiletsinfo="" *,csplfiletsinfo="" *=""> *>>,false>
]
and
[
_Traits=std::_Tmap_traits<cstring,clist<csplfiletsinfo *,csplfiletsinfo="" *=""> *,std::less<cstring>,std::allocator<std::pair<const cstring,clist<csplfiletsinfo="" *,csplfiletsinfo="" *=""> *>>,false>
]
|
|
|
|
|
I wrote a C++ program the I run on a NT machine that writes structures to a binary file. I then move the binary file to a Unxi machine and I can't read the files correctly.
I am swaping the bytes, is this all that I need to do?
Thanks for ANY help.
Jim
|
|
|
|
|
Check the byte alignment. It is possible that the data is not written to the offset that you expect.
Ant.
|
|
|
|
|
It really depends on the architechture of each of the machines -- they might both be Little Endian, Big Endian, or a combination of the two. That is to say, you might not need to swap the bytes at all -- doing so could be what's giving you trouble.
If at all possible, try using the ntohs() and ntohl() functions to ensure you get your data correctly on any architecture.
--Dean
|
|
|
|
|
|
Depending on the machine architecture, and that the sizes of similar data types are the same byte length, I have seen issues where machines are not "byte" swapped but are "word" swapped. In those cases, it was every set of two-bytes that needed to be swapped with the next set of two-bytes. This is different than big/little-endian swapping.
If you are writing floating point values into the file, check that the NT format and the UNIX format are the same. NT probably uses the IEEE floating point format and some non-PC UNIX machines (and some hardware items) use a DEC format. This means that the meaning of the bits within a 4-byte floating point word are different ... different size mantissa, exponent, placement of sign bit, etc. I have had to re-align floating point bits between machines.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Hi !
I'm implementing into my project a CToolBarCtrl control. When I call the Create function, it doesn't matter the CRect that I set up because it always draws it on the top or bottom of the window (depends on the property that you set up), but I need to draw it into a CRect like floating into the window.
Could you help me please ?? If you could paste a very little example... thank you !!
Thanks in advance.
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
if ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
|
Can anyone give me link or where i start
i need to create new audio file foemat like .wav,.dss
pls help me regarding this...
thanx
regards
rajesh
|
|
|
|
|
How can I use visual c++ to establish a ipc$ connection with a remote hos and copy file from the host or upload a file to the specified path of the host?Is there any detailed demostrations?thanks!
|
|
|
|
|
How to implemet MAPIGUID ?example
dadsadasd
|
|
|
|
|
Other than mapiguid.h, I do not know what MAPIGUID is. Can you explain a bit further?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thank u for reply.Part of My Apps I want run MAPIUID's? ie mean Access the OutLookExpress Dialog Boxes,Creating New Accounts,Get Accounts .. etc dialogboxes?
I want how run Internet Connection Wizard?
Pl Give an Example.
dadsadasd
|
|
|
|
|
asv wrote:
Access the OutLookExpress Dialog Boxes,Creating New Accounts,Get Accounts .. etc dialogboxes?
Unless Outlook Express exposes an automation interface (like Outlook does), I'm not sure how you'd do this.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I had problem with LUNCHWIZARDENTRY? I was unable run apps?
satyavasu
|
|
|
|
|
Hi,
I'll try to make this as straight forwards as possible I'll describe the situation I want to create and the problem I'm facing as a consequence.
I have a simple MFC-App (MfcApp.exe ). It has a resource-DLL (MfcApp-Res.dll ) which it maps using AfxSetResourceHandle .
I want to build an MFC-Extension-DLL (MfcExt.dll ) with new controls in it. I want this Extension-DLL to use resources from an additional Dll (MfcExt-Res.dll ).
What I would like to have:
* MfcExt.dll loads resources from MfcExt-Res.dll
* MfcApp.exe loads resources from MfcApp-Res.dll and from MfcExt-Res.dll (without explicitly stating MfcExt-Res.dll anywhere, just by linking to MfcExt.dll )
But,
Once the MFC-App will use the MFC-Extension-DLL, I expect a mess, why ?
MSDN docs state that the MFC-App and Extension-DLL will use the same resource-dll handle.
How can this be handled cleanly ?
What is the percise function of CDynLinkLibrary in this case ?
Thanks for the help,
|
|
|
|
|
The CDynLinkLibrary is a list of libraries loaded dynamically during the run of the MFC program. When the MFC program requires a resource, it will traverse the chain of the dll in the list and stop once it finds the resource that matches. If you want the MfcExt.dll to only use resources from the MfcExt-Res.dll, you have two easy choices as I see it:
1. Always adjust the AfxSetResourceHandle() prior to any calls within MfcExt.dll that might load resources to the MfcExt-Res.dll and then set it BACK once you are done loading resources, which will cause it to load resources from the desired resource dll
2. Only use resouce identifiers in the MfcExt-Res.dll that do not overlap any within the MfcApp-Res.dll module. When the MfcApp.exe tries to load a resource, it will check MfcApp-Res.dll and then search in MfcExt-Res.dll. The MfcExt.dll will do the same search, but it will only find the resources in the MfcApp-Res.dll.
I prefer to PLAN my resource utilitization, assign numerical identifier ranges, and go with option 2 myself. It saves tracking down resource loading and a lot of busy work associaed with option 1.
|
|
|
|
|
I have a activex control which expects HDC as one of its arguments.
In my program I have my window dc which I want to pass it on to this function, now the issue is how do I convert the HDC to long.
If this is not possible, how should one go about achieving this, I dont have access to the source of the activex.
Thanks,
Kannan
|
|
|
|
|