On Fri, 2010-04-23 at 11:31 -0400, Dave McGuire wrote: > > There > > is nothing worse than an "optimised" parser looping over memory with > > constructs like if (*i++ == '(') ... or some such. > > Is this why GTK apps tend to be so unbelievably bloated? > > I mean, I see (and like!) the value of such an approach, but > surely you see the disadvantage.
Sometimes these tetechniques are beneficial, but in a GUI app (not in a time-critical path) they can provide a bigger detraction in terms of code clarity. PCB has had a number of bugs where pointer arithmetic featured in home-brewed string parsers, and missed "corner" cases such as walking off the end of a string with certain inputs. This sort of "old-school" C-code is difficult to get right, and can be difficult to debug when they are causing issues. Unless code is in a critical path, it is often better to use higher level APIs which someone else has done the leg-work of getting correct, and maintaining. (Perhaps coded in a highly efficient way). Many people would argue C / C++ is the wrong language to write a GUI in in the first place. Python etc.. allows you to be much more expressive, and focus your time where it matters. I say using higher level APIs in C is a decent compromise. -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me) _______________________________________________ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user