RE: [Dev-C++] [Fwd: Strings management help djgpp vs dev-C++]
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ho...> - 2002-05-30 03:41:20
|
I was refering to C. As you did notice you have added an extra '\0' to every string. "AN" is 'A' 'N' '\0' "AN\0" is 'A' 'N' '\0' '\0' You assign it in an element for 3 characters, meaning that the last '\0' is lost. This is valid in C, but C++ is more protective and it gives an error (you lose characters). But i saw you do it in a C file and you should not get an error. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net <http://www.noicys.cjb.net/> * Alternative URL: http://run.to/noicys -----Original Message----- From: Ioannis Vranos [mailto:no...@ho...] Sent: Thursday, May 30, 2002 6:34 AM To: Dev-C++ Mailing List (dev...@li...) Subject: RE: [Dev-C++] [Fwd: Strings management help djgpp vs dev-C++] It compiles ok in Dev-C++ 4.9.3.0 (Beta 3) as it should. Probably it was refering to another array? Also the individual {} are not needed. You can write it static char Sidat[][3] = {"AN\0","ST\0","AP\0","AT\0"} ; . Also static in concurrency is a nightmare, so i hope you intent its use only for one call at a time (not used by many applications/threads at the same time). Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net <http://www.noicys.cjb.net/> * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Roberto Ricardi Sent: Thursday, May 30, 2002 6:19 AM To: Dev...@li... Subject: [Dev-C++] [Fwd: Strings management help djgpp vs dev-C++] X400 Asunto: Strings management help djgpp vs dev-C++ Fecha: Thu, 30 May 2002 00:05:53 -0300 De: Roberto Ricardi <mailto:rob...@ar...> <rob...@ar...> A: mailto:dev...@li... Hi group ! Please I downloading dev-C++ and triying to compile and .... static char Sidat[][3] = {{"AN\0"},{"ST\0"},{"AP\0"},{"AT\0"}} ; told me 746 C:\Dev-C++\c\ELCOMMON.C initializer-string for array of chars is too long anybody cant sleep just now ?? Thanks a lot Rob |