| Are volatile C strings printed in C++ by special rules? See the
comments at the end of the following C++ program.
John
vcp.cc:
---------------------------------------------------
#include
#include
int main(int argc, char **argv)
{
volatile char str[] = { 'a', 'b', '\0' };
std::printf("%s\n", str);
std::cout << str << "\n";
return 0;
}
/*
* $ uname -a
* Linux localhost.localdomain 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 i686 i386 GNU/Linux
* $ gcc --version
* gcc (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
* Copyright (C) 2003 Free Software Foundation, Inc.
* This is free software; see the source for copying conditions. There is NO
* warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $ make vcp
* g++ vcp.cc -o vcp
* $ ./vcp
* ab
* 1
* $
*/ |