paul_c wrote: > On Sunday 13 July 2008, Kenneth Lerman wrote: >>> Why do you need to increase the size of the array ? >> My plan for GWiz is that each wizard is contained in a separate >> directory. > > Perhaps a relative path (or appending to a gwiz_root) would work as well.. > >> > Are you aware of the wider implications of doing so ? >> >> Aside from using more memory, I'm not aware of any. I hope that those >> who are aware of other implications will clue me in. > > sizeof(char) * PATH_MAX for each process reading from the task status plus an > additional sizeof(char) * PATH_MAX * 4 (if the data is encoded) for the > master buffer. Then there is the time taken to encode/copy/decode the data.
Memory is cheap. What encoding is done? (I wasn't aware of any.) > >> > How many users use path/file names larger than 255 char ? >> >> In this context, none. If they did, it wouldn't work. How many would >> like to? At least one. At any rate, it is rather arbitrary to make the >> maximum length the same as the length of a line. And it is clearly bad >> form to use the same #define for both. > > Is it any worse than allocating 4K of space when the string may only use 30 > bytes ? It is a "crime" of a different nature. The name of a #define should relate to its function. In this case the function of LINELEN is to define the maximum length of a source line (actually a "block" in the standard). The function of PATH_MAX is to define the maximum length of a path. These are very different things. It's reasonable to consider whether those two things should have the same value. I don't think it good practice for them to have the same name. > > Suggestion: include <limits.h> and use _POSIX_PATH_MAX > Alternative: Leave the task_stat struct as is, and _IF_ it becomes an issue > at > some point for a significant number of users, increase the size by a modest > amount. For now, I'll probably follow your suggestion with a minor change. I'll include <limits.h> (although I suspect it's already included indirectly). I'll probably define something called INTERP_PATH_MAX and for now #define it to be _POSIX_PATH_MAX. That will permit a change of size to be made in a single place. I don't know what include file that should be in, but I'm sure I'll figure it out. > > Internally, feel free to use std::string rather than a fixed size buffer. As I'm really a C programmer (and an Objective-C programmer), not a C++ programmer, I've never been really comfortable with the std library. Templates in C++ have always driven me crazy. Maybe some time when I'm feeling mellow, I'll take the time to learn enough to rework the interp to use std::string. > > --- > > Paul. > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Emc-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-developers Thanks for your comments, Ken -- Kenneth Lerman Mark Kenny Products Company, LLC 55 Main Street Newtown, CT 06470 888-ISO-SEVO 203-426-7166 ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
