Click here to Skip to main content
15,887,328 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
Was I being dogmatic? Blush | :O

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].

Thanks for the discussion.

"We make a living by what we get, we make a life by what we give." --Winston Churchill

GeneralRe: string buffer Pin
CPallini11-Dec-07 1:49
mveCPallini11-Dec-07 1:49 
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 
GeneralFunction pointer Pin
George_George10-Dec-07 0:46
George_George10-Dec-07 0:46 
GeneralRe: Function pointer Pin
CPallini10-Dec-07 0:57
mveCPallini10-Dec-07 0:57 
GeneralRe: Function pointer Pin
George_George10-Dec-07 1:11
George_George10-Dec-07 1:11 
GeneralRe: Function pointer Pin
CPallini10-Dec-07 2:03
mveCPallini10-Dec-07 2:03 
GeneralRe: Function pointer Pin
George_George10-Dec-07 2:27
George_George10-Dec-07 2:27 
GeneralRe: Function pointer Pin
CPallini10-Dec-07 2:37
mveCPallini10-Dec-07 2:37 
GeneralRe: Function pointer Pin
toxcct10-Dec-07 2:39
toxcct10-Dec-07 2:39 
GeneralOK buddy! Pin
CPallini10-Dec-07 2:43
mveCPallini10-Dec-07 2:43 
JokeRe: OK buddy! Pin
toxcct10-Dec-07 2:44
toxcct10-Dec-07 2:44 

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.