taking address of temporary array
See original GitHub issueXGBoost Classifier generated code for objective = ‘binary:logistic’, does not compile in c++
The last line that copies the prediction to what i am assuming to be a 0 or 1 sigmoid output value.
memcpy(output, (const double[]){(1.0) - (var1000), var1000}, 2 * sizeof(double));
gives this error:
error: taking address of temporary array
memcpy(output, (double[]){(1.0) - (var1000), var1000}, 2 * sizeof(double));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
it highlights this part:
{(1.0) - (var1000), var1000}
does anyone know how I can fix this error? And what if I just returned the raw values from var1000 could that work also?
Compiler:
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
CXX_FLAGS
-std=c++11
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
C++ error: "taking address of temporary array" - Stack Overflow
This is actually a C++ extension borrowed from "compound literal" in C. In C this is valid code because the temporary has automatic...
Read more >How to solve 'taking address of temporary array' error ... - Quora
A “taking address of temporary array” error means that you were trying to take the address of a temporary object. That won't do...
Read more >taking address of temporary array - Arduino Stack Exchange
That trick is to use a string, not an array. After all, a string is just an array, it's just handled slightly differently...
Read more >normalize_ts.cpp:217:49: error: taking address of temporary ...
In file included from normalize_ts.cpp:37:0: normalize_ts.cpp:217:49: error: taking address of temporary array fprintf(stderr, ...
Read more >Arduino: Error taking address of temporary array ... - YouTube
Arduino: Error taking address of temporary array when passing compound literal arrayHelpful? Please support me on Patreon: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When trying on random data I get:
When I use:
the error goes away
Model Used + Random Data:
And the model used with the random data has the same exact output / issue:
Here is my entire conda environment: conda_environment.txt
Here is the random model (which is the same as the other model minus the data, but same issue. random_model_test.txt
G++ Compiler used:
OK, thanks for sharing the code with random data to reproduce the error! I’ll try it on my end.