X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Mok-Kong Shen Newsgroups: comp.os.msdos.djgpp Subject: Re: Array initialization question Date: Sat, 27 Aug 2011 23:27:33 +0200 Organization: albasani.net Lines: 22 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net WhsxU/blOB/fSD0V1UAKHqEOLIlLV7yEDXgIemJ9HsBbu7dwP9hYL8/JDK6uKgxMYIwQjsl0oqdqoAp/Y72hP5u8qedlJFtx6MuDaIMs51xlS9yg7uDliYEkbw8ZThel NNTP-Posting-Date: Sat, 27 Aug 2011 21:26:04 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="eONNf11oKk5cNe8mXCXVNH07IsHtx3rDafSRTaCPEAnb/WZt0IadlTgN5/1XJEREENx+H+s+mry6VSNkzXzODJ9Vqnhz8sYhEWV+zT6ngJ6m5aY4X7Xa2UK7V+cDlSDx"; mail-complaints-to="abuse AT albasani DOT net" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0 In-Reply-To: Cancel-Lock: sha1:CoMFNas/HyePqWLdxtcWU+Ck+kk= Bytes: 1831 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Am 26.08.2011 23:36, schrieb Mok-Kong Shen: > I found that lines like > > const int sz=3; > int arr[sz]; > > seem to work well as C code. However I can't have an initialization list > e.g. > > int arr[sz]={ 0,1,2 }; > > On the other hand such initialization lists seem to be ok for codes > running in Visual C++. Is this due to a difference between standards > of C and C++? Many thanks for all the follow-ups. It seems that it's indeed a matter of difference between standards (or else implementation?). For I changed the file extention from .c to .cpp and gcc worked without complaints. M. K. Shen