Timeline for Passing a pointer to an array in a constructor
Current License: CC BY-SA 3.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 28, 2015 at 13:10 | comment | added | Stack Exchange Broke The Law | @juanchopanza s/decays/would decay/ then, if it bothers you. | |
| Feb 28, 2015 at 11:12 | comment | added | juanchopanza |
@immibis Because the first element is a pointer. And the function parameter is not a pointer to a pointer. The array can't decay to A*.
|
|
| Feb 28, 2015 at 10:45 | comment | added | Stack Exchange Broke The Law | @juanchopanza Why do you think it can't decay to a pointer to its first element? | |
| Feb 28, 2015 at 10:42 | vote | accept | roymcclure | ||
| Feb 28, 2015 at 10:35 | answer | added | Ron Tang | timeline score: 2 | |
| Feb 28, 2015 at 10:34 | answer | added | flogram_dev | timeline score: 1 | |
| Feb 28, 2015 at 10:22 | comment | added | πάντα ῥεῖ |
@roymcclure Shouldn't this A* array_id[SOME_CONST]; be A array_id[SOME_CONST];?
|
|
| Feb 28, 2015 at 10:20 | comment | added | juanchopanza | @immibis Why would the identifier for the array decay here? There's nothing it can decay to. | |
| Feb 28, 2015 at 10:13 | comment | added | Stack Exchange Broke The Law |
Right, the identifier for the array decays into a pointer to the first element of the array. The first element of the array is an A*, so a pointer to that is an A**, and you don't have a constructor that accepts an A**.
|
|
| Feb 28, 2015 at 10:10 | answer | added | Some programmer dude | timeline score: 1 | |
| Feb 28, 2015 at 10:10 | history | edited | roymcclure | CC BY-SA 3.0 |
deleted 24 characters in body
|
| Feb 28, 2015 at 10:08 | comment | added | juanchopanza | It looks like you are passing an array of pointers where a pointer is expected. | |
| Feb 28, 2015 at 10:03 | history | asked | roymcclure | CC BY-SA 3.0 |