Thread (1 message) 1 message, 1 author, 2004-05-19

Re: ELDK 3.0 C++ Problem

From: Wolfgang Denk <hidden>
Date: 2004-05-19 23:17:02

In message <6F45E974A11B294383FD819C76719D8701984F@txex2ku01>
Carlo Parravicini wrote:
The problem is with your statement, "new int (1000)". This should be
"new int [1000]". You are telling the compiler to initialize 1 integer
to 1000 instead of allocating 1000 integers. Replace the parens with
brackets and it should work.
Yes, this was one of the problems with his code.

Anotrher is that the length in the memset() is probably wrong:
quoted
  int *p = new int (10000);
  memset ( p, 0, 10000);
This clears only a small part of the (wanted?) array.


The whole code looks broken.

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Our OS who art in CPU, UNIX be thy name.
Thy programs run, thy syscalls done,
In kernel as it is in user!

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help