public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eljay Love-Jensen <eljay@adobe.com>
To: Milena Constantino Caires <milena@registro.br>, gcc-help@gcc.gnu.org
Subject: Re: signed/unsigned char
Date: Wed, 20 Jul 2005 14:55:00 -0000	[thread overview]
Message-ID: <6.2.1.2.2.20050720095738.0243f5b0@iplan-mn.corp.adobe.com> (raw)
In-Reply-To: <20050720144555.GA63554@registro.br>

Hi Milena,

> char* c = new char(1024);

This allocates a single character, initialized with the value 1024.  (Since 1024 is bigger than what a char can hold on most systems, it will get sliced.)

>I know that the correct form of this memory allocation is "[1024]" and not "(1024)" but sometimes it occurs by mistake.

Both forms are correct.

You can allocate an array of char.

You can allocate a single char.

>The compiler is not supposed to complain about it???

No, there is nothing to complain about.  You are allowed to allocate a single object.

HTH,
--Eljay

  reply	other threads:[~2005-07-20 14:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-20 14:46 Milena Constantino Caires
2005-07-20 14:55 ` Eljay Love-Jensen [this message]
2005-07-20 14:59 ` random

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6.2.1.2.2.20050720095738.0243f5b0@iplan-mn.corp.adobe.com \
    --to=eljay@adobe.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=milena@registro.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).