4 ms·
Somewhere in Redmond, WA PageStyleTagsW tags[ Thinks for 5 seconds PageStyleTagsW tags[30]; /* should be enough for any page / Goes and gets a free soda* S
by matthavener 17y ago
Somewhere in Redmond, WA
PageStyleTagsW tags[
Thinks for 5 seconds
PageStyleTagsW tags[30]; /* should be enough for any page /
Goes and gets a free soda*
Sometimes imposing arbitrary limits in C is a lot easier than manually managing dynamic memory in the heap..
- alttab 17y agoI've seen this where I work all the time. I've also seen code where the developer created 25 different structures named structure_type_X where X is 1-25, the size of the structure's internal buffer. How do you deal with 25 different structure types with nothing different but the name and buffer size? Why, a switch statement of course...
- CamperBob 17y agoIt's pretty common for Verilog developers to think they're writing C code, but that's the first time I've heard the converse.
- alttab 17y agoThe guy does some pretty interesting stuff - writes scripts to automatically generate structures so class variables are byte aligned and within cache lines and all that. But he has made some of the dumbest use of C++ I have ever seen. Verbs as classes, sometimes making it obvious that inheritance escapes him, and an entire cpp file over 10k lines long that does nothing but assert the mass amount of assumptions his code makes. The one method is literally called 'check_assumptions.' I'm not bitter though.
- bradtgmurray 17y agoSounds like a problem for C++ templates.
- lanstein 17y agoNow you have two problems.
- nostrademons 17y agoSounds like Pascal...
- InclinedPlane 17y agoI'm pretty certain this is the case too, just an arbitrary limit due to coding laziness. I'm sure people argued about it and decided that 30 external style sheets was way more than enough since using that many would be crazy and cause plenty of problems on its own. Then, of course, later on the team decides how they want to handle inline styles and someone suggests they've already got all this infrastructure for handling external styles, why not just use that? Nobody reevaluates the style limit and then hijinx ensue down the road.
- Periodic 17y agoI have to admit, there have been a few times I've written comments like the following: /* Just a quick static array to get it * working. Should be enough for all the * usual tests so we can work on core * functionality. * * TODO: change it to a linked list or * something to dynamically track style * tags. * * Update: Changed from 16 to 30 because Alex * tossed in a new test that breaks this * build. This really ought to be updated * next major release, but for now we just * need to get it working. */
- InclinedPlane 17y agoAvoiding these sorts of pitfalls is one of the greatest benefits to using a modern language with good generics support. In C#, for example, it's actually easier to code with lists than with arrays, so you can skip the "fix it so it doesn't have an arbitrary range limit" coding step (which often never gets done anyway).
- Malus 17y agoThe not-so-modern language that IE is written in (C++) has a similar construct (std::vector) in its standard library. It is possible that code was originally written prior to the widespread adoption of the STL and was never updated to use it.
- cakesy 17y agoClearly you have never worked at Redmond. You would first have to go through several levels on managers to get this number, each with their own uselss input to make sure they don't become irrelevant. Can't see this being done in anything less than 2 weeks.