Why does this need auto? [closed] - c++

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 months ago.
Improve this question
auto data = new char[480][640][3]();
char data = new char[480][640][3]();
First works.
Second doesnt.
Why? Isn't auto supposed to just replace itself with the type of the initializer?

Because the type isn't char. The type is char(*)[640][3] and the declaration would be written as
char (*data)[640][3] = new char[480][640][3]();

Related

How to change comma to period when typing double number in TextField? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 days ago.
Improve this question
How to change comma to period when typing double number in TextField?

Meaning of vector<string = ">v; while declaring vector with data string [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
In C++, please explain meaning of string = "" in vector declaration -> vector<string = "">v;
Assuming these are std::vector and std::string, it is syntactically invalid. It won't compile.
Otherwise, you need to provide more context like: what are vector, string and v? Are they objects? Objects of what type? Are they macros? Are they classes? Are they templates? It could do anything. Here it prints Hello, World, here it calculates pi, here it creates a std::vector of std::string, and here it doesn't compile.

C++ error: decomposition declaration not permitted in this context [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
Why is g++ giving an error like this?
blahblah.h:80:10: error: decomposition declaration not permitted in this context
float[NUM_OUTPUTS] output_buffer;
(Already solved, but creating this because there's no good google hits for this error text, and the error message is inscrutable.)
In C++ declarations, the array size goes after the variable name, not after the type:
float output_buffer[NUM_OUTPUTS];

why does a simple cast from int to double not work [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
i have a simple function, in which i need to divide two integers. But the casting does not work.
I can't understand what is wrong in my code:
double new=0.0;
if(N>0) new = double(Ns)/double(N);
The error-message at the place double new; is (error:expected unqualified-id) and at the place new=double(Ns)/double(N)
and at
new is a reserved keyword in C++. Pick another name for your variable:
double double_new=0.0;
if(N>0) double_new = double(Ns)/double(N);
new is a reserved keyword in C++. You cannot have objects named new.

do_trucate in jinja2, correct usage needed [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I think I saw something on using this to truncate test as a filter, but I've seen to no idea how to use it. Using as xx|do_trucate(20) gives the following:
TemplateAssertionError: no filter named 'do_truncate'
What is the correct usage?
Doh, from the spec I saw
do_trucate
http://code.nabla.net/doc/jinja2/api/jinja2/jinja2.filters.html
But in reality, its just truncate