Click here to Skip to main content
15,896,432 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: string buffer Pin
David Crow10-Dec-07 4:01
David Crow10-Dec-07 4:01 
GeneralRe: string buffer Pin
CPallini10-Dec-07 6:13
mveCPallini10-Dec-07 6:13 
QuestionRe: string buffer Pin
David Crow10-Dec-07 6:20
David Crow10-Dec-07 6:20 
GeneralRe: string buffer Pin
CPallini10-Dec-07 6:32
mveCPallini10-Dec-07 6:32 
GeneralRe: string buffer Pin
David Crow10-Dec-07 7:15
David Crow10-Dec-07 7:15 
GeneralRe: string buffer Pin
CPallini10-Dec-07 9:01
mveCPallini10-Dec-07 9:01 
GeneralRe: string buffer Pin
George L. Jackson10-Dec-07 7:15
George L. Jackson10-Dec-07 7:15 
GeneralRe: string buffer Pin
CPallini10-Dec-07 9:07
mveCPallini10-Dec-07 9:07 
GeneralRe: string buffer Pin
George L. Jackson10-Dec-07 9:44
George L. Jackson10-Dec-07 9:44 
GeneralRe: string buffer Pin
CPallini10-Dec-07 10:42
mveCPallini10-Dec-07 10:42 
GeneralRe: string buffer Pin
George L. Jackson10-Dec-07 11:27
George L. Jackson10-Dec-07 11:27 
GeneralRe: string buffer Pin
CPallini10-Dec-07 13:22
mveCPallini10-Dec-07 13:22 
GeneralRe: string buffer Pin
George L. Jackson10-Dec-07 13:49
George L. Jackson10-Dec-07 13:49 
GeneralRe: string buffer Pin
George_George10-Dec-07 15:54
George_George10-Dec-07 15:54 
GeneralRe: string buffer [modified] Pin
George L. Jackson10-Dec-07 16:36
George L. Jackson10-Dec-07 16:36 
GeneralRe: string buffer Pin
CPallini10-Dec-07 21:44
mveCPallini10-Dec-07 21:44 
GeneralRe: string buffer Pin
George L. Jackson11-Dec-07 0:50
George L. Jackson11-Dec-07 0:50 
GeneralRe: string buffer Pin
CPallini11-Dec-07 1:49
mveCPallini11-Dec-07 1:49 
George L. Jackson wrote:
Was I being dogmatic?

My point is that &array seems to work okay with formatted output but may not work in other situations. &array in C++ is a different type than arrar and &array[0], and behaves differently. Yes, they all return the same address; but, remember, C is no longer a true subset of C++ since there are now too many gotchas.

#include <iostream>
#include <string>

using namespace std;

void print_myself(wchar_t* myself)
{
wcout << myself << endl;
}

int _tmain(int argc, _TCHAR* argv[])
{
wchar_t myself[] = L"George Jackson";

print_myself(myself);
print_myself(&myself[0]);

// wchar_t (*myself_ptr)[15] = &myself;
print_myself(&myself); // Won't compile in C++ as is.

return 0;
}

Thus, it should not even be an alternative to array and &array[0].


I give up. Roll eyes | :rolleyes:




George L. Jackson wrote:
Thanks for the discussion.

You're welcome, I was just kidding.
Big Grin | :-D

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.


GeneralRe: string buffer Pin
David Crow11-Dec-07 4:02
David Crow11-Dec-07 4:02 
GeneralRe: string buffer Pin
George L. Jackson11-Dec-07 4:23
George L. Jackson11-Dec-07 4:23 
GeneralRe: string buffer Pin
David Crow11-Dec-07 4:36
David Crow11-Dec-07 4:36 
GeneralRe: string buffer Pin
CPallini11-Dec-07 4:28
mveCPallini11-Dec-07 4:28 
GeneralRe: string buffer Pin
David Crow11-Dec-07 4:33
David Crow11-Dec-07 4:33 
GeneralRe: string buffer Pin
CPallini11-Dec-07 4:47
mveCPallini11-Dec-07 4:47 
GeneralRe: string buffer Pin
George_George10-Dec-07 15:32
George_George10-Dec-07 15:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.