Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Embeddable GCC

Name: Anonymous 2016-09-08 14:56

Is there a small version of GCC for shipping with Windows program? Because Mingw installation takes frigging gigabyte, including a lot of bloat, like C++ and fortran compiler, with useless crap, like directx bindings.

Name: Cudder !cXCudderUE 2016-09-16 3:28

And it makes me wonder, a function can't return an array, but if a function can return a struct, can it just return a struct containing nothing but an array?
Yes.
struct k {
char foo[256];
} myfunfunc() {
struct k ks = { "Foo!" };
return ks;
}

A function "returning" a struct actually gets converted to a function having a pointer to a struct as its first parameter:
struct k {
char foo[256];
} *myfunfunc(struct k *_ret) {
struct k ks = { "Foo!" };
memcpy(_ret, &ks, sizeof(ks));
return _ret;
}

Those two above should compile to byte-identical code, and at least in MSVC6, they do.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List