Messages in this thread | | | Date | Tue, 01 Jul 1997 09:46:23 +0200 | From | Joerg Pommnitz <> | Subject | Re: kernel programming questions |
| |
Richard B. Johnson wrote: > > On Mon, 30 Jun 1997, Michael Bruck wrote: > > > Ok, two short questions: > > > > Is there a arch-independant type available for the > > save_flags macro ? (flags_t ??) > > > > Is there a problem that could prevent one from using memory > > alloc'd from stack in the kernel like > > > > int foo(int bar) > > { > > int foo_bar[bar]; > > ... > > } > > Even though that works.... There SHOULD be a problem with it! Don't > write code like that. For some reason gcc lets you get away with it. > If you must write code like that it's broken from the start. Automatic > variables are supposed to be automatic, not dynamic.
This is a gcc extension. Since almost every part of the kernel depends on these, that's not a problem. The problem is that every process has just a single page of kernel stack space (4K for x86). So, better allocate some memory and release it on function return.
| |