Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
const char* = new char[6]
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Frederick Gotham, post: 2581151"] S S posted: The Standard provides no such guarantee (well I'm 99% that it doesn't) -- if you want each element to be default-initialised, you'll have to use the empty parentheses. Testing it will do you no good, as I know of at least one implementation that default-initialises new'ed memory regardless of whether you provide the empty parentheses. Anyhow, even if the empty parentheses were redundant, I would still put them in, just as how I write: int main() { static MyPOD arr[5] = {}; } instead of: int main() { static MyPOD arr[5]; } Indeed, the chain brackets are redundant because static data always gets default initialised... but nonetheless, they express clear intent. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
const char* = new char[6]
Top