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

Programming advice: DRY

Name: Anonymous 2016-10-07 0:29

Don't Repeat Yourself

Coding tip for y'all: Don't Repeat Yourself.

you can't even *call* a function twice. you have to use map
map(f,[x,y]);
much much beter and more functional than
f(x); f(y);

Name: Anonymous 2016-10-07 14:03

>>12
'malloc' generally implies the call to malloc()[/spoiler] function. stack allocation is completely different beast as at heart it's just moving a stack pointer in a desired direction while [spoiler]malloc()[/spoiler] is much more expensive because of the more complex heap-related data structures (how much more expensive they are depends on the allocator you're using) as well as the need to occasionally use a syscall ([spoiler]brk()[/spoiler] on Linux). unless memory restrictions are very strict, you shouldn't care that much about a stack frame or two but you certainly should avoid too many [code]malloc()[/spoiler] and [code]free() calls

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