#structs and pointers

4 messages · Page 1 of 1 (latest)

rapid coral
#

notice that the last line is mutating the value, inside the QueryRow call

#

these appear to be fields generated by the database on insert

#

if it weren’t a pointer, those changes would be constrained to within the function and wouldn’t propagate back to the caller

#

that said, i do find the API slightly weird. a caller of a function called Insert typically wouldn’t expect it to mutate the passed-in value. having the function return the ID (or even the whole struct with the new values applied) might be a more familiar pattern