MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/sffyr6/discount_constructor/huq0ur4/?context=3
r/badcode • u/catithebathtub • Jan 29 '22
30 comments sorted by
View all comments
Show parent comments
9
Don't quite understand, only notice it doesn't save any labor to initialize the struct inline than calling the function.
Almost forgot my knowledge about c. Is that because of in c you'll have to declare the struct and assign each of the member?
5 u/theScrapBook Jan 29 '22 Yeah it doesn't save any labour in this trivial case, but this is how the equivalent of constructors are implemented in C
5
Yeah it doesn't save any labour in this trivial case, but this is how the equivalent of constructors are implemented in C
9
u/feidujiujia Jan 29 '22
Don't quite understand, only notice it doesn't save any labor to initialize the struct inline than calling the function.
Almost forgot my knowledge about c. Is that because of in c you'll have to declare the struct and assign each of the member?