>> > why is buf[] declared in so many places to be rather small in the >> .c files >> > when it is declared in structs.h and db.h to be size > > > MAX_STRING_LENGTH? > > > this seems a little odd to me. > > > There is an excellent reason for declaring local buf's. Consider the > > following piece of code: > > > ACMD(my_command) > > { > > sprintf(buf, "Hello"); > > do_some_other_processing(); > > strcat(buf, "\r\n"); > > send_to_char(buf, ch); > > } > > > What if do_my_own_processing uses buf[], too? Chaos. > > > Functions that get called from other functions often have their own local > > bufs to avoid such problems. > > > -Jeremy > ok... that makes a lot of sense, any particular reason they all use the > same name? and not something like local_buf? What's wrong with buf? Personaly I would like to know why not all bufs are local. Memory? -Jaco-
This archive was generated by hypermail 2b30 : 12/07/00 PST