This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: misusing placement new OR possible cxx bug




Sent from my iPhone

On Oct 13, 2008, at 9:10 AM, "Ralovich, KristÃf" <kristof.ralovich@gmail.co m> wrote:

Hi GCC developers,

I have a c++ source, that I think is wrong (wrt the c++ standard), but
accepted by g++ (and msvc too)!

----------------------------------------

int
main(int argc, char** argv)
{
 char* d = new char[256, 256];
 return 0;
}

----------------------------------------

Is this the use of 'placement new' in weird syntax I didn't know
before, or is this code wrong and accidentally accepted by gcc? In the
former case, please correct me and sorry for the noise!


This is neither. The code is using the comma operator.


Thanks,
Andrew Pinski



Thanks, Kristof


PS.: my 'g++ -v' says:


Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian
4.3.2-1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--enable-mpfr --enable-targets=all --enable-cld
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread model: posix
gcc version 4.3.2 (Debian 4.3.2-1)

PS2.: Please CC me!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]