kstyle.diaryland.com Sunday, Oct. 13, 2002

HOT WET TEENS... WAITING JUST FOR YOU !
6:37 p.m.

sorry, gotta think about really snappy entry titles, now that i've got the previous five thingy up...anybody got a good name for my monkey?

well, this has sure been celebrity corner lately...but what about me? i've got the next two days off, so here's a list of some things i'd like to get done...sorry, it's a little boring -

1.trim the hedge in the backyard.

2.trim the ivy growing up the post at the front of the house. (it's getting a little out of control...)

3.pull up what's left of the veggie garden, which was a real disaster this year...between the computer and the cat, my mind was elsewhere. i got a little broccoli and just a few zucchini...too bad i can't live on parsley and rosemary! todd, you would piss yourself laughing if you saw my garden. this was the third year in a row i've had a garden out back, and i think the soil is pretty dead...next year, i'm gonna get plenty of steer manure and do it right. the last two years i did pretty good, but this summer the neglect was pretty amazing on my part...i mean, if i can't even get zucchini to grow...watering more than once a week would have helped, too...oh well, the gentleman farmer has learned his lesson.

4. mail that package to k. maria.

5. mail that photo cd to alan in n.y.c.

6. send that book i didn't order back to stage and screen.

7.send that book i didn't order back to sunset books - this could be difficult, cuz i opened it, and i might have to pay postage...or maybe i can send it back c.o.d. - i don't think i've ever done that...they are sending me cards that if i don't send them back, the book comes automatically...i never signed up for this, and i don't even remember getting the first card. but if i did, i probably just tossed it, cuz it's just a card, no envelope. i think this is kind of sneaky, don't you?

8. a thorough vacuuming of the entire house. while the cat is apparently flea-free now that i applied that advantage stuff to the back of his neck, i'm getting bitten on my ankles. i know vacuuming won't solve the problem entirely, but i just could never do one of those flea bomb things...it gives me the willies...i picture sticky, deadly poison on every surface in the house. and while i have easy access to the neighbor's trees, i can't see walking around with eucalyptus leaves stuffed in my socks...clare, any suggestions?

9. go to sears or ross (dress for less!) and get some new black pants for work.

10. get SERIOUS about spreading around some magazines to friends, neighbors, and co-workers. if you take a look HERE, you might understand how a few months of mags piling up can become a little overwhelming...

11. figure out exactly where to keep the great two-volume set of the new century dictionary(published 1946) that i got recently at the used bookstore. each volume must weigh about five lbs. they were 20 bucks, but when i took them up to the counter to pay for 'em, i noticed that there were some loose pages in one volume. the guy said "well, i'll have to deep-discount that!" so i got 'em for 10 bucks. it's just one four-page piece that's loose, it's not even torn. i've been using a small paperback copy of the americam heritage dictionary, and you'd be surprised at what's NOT in there...i'll guess i'll just keep 'em handy on my big desk here...by the way, i had an idea...i thought it might be fun to see pictures of where everybody does their diary posting from...if anybody would like to send me a picture of their workstation, desk, cardtable, or plywood sheet resting on two 55-gallon oil drums, i'd like to put together a little photo gallery or something...maybe i could set up a third page at BLACK PINEAPPLE GALLERY ...if ya don't have a scanner, email me for the physical address....and don't tidy up those piles of papers and moldy coffee cups...i wanna see your "real" world...we're all friends here, right?

12. put the finishing touches on reinstalling my computer...i need to get the printer and scanner up and running....i'm afraid i'm gonna get all confused and do something wrong...but hey, i'm way more savvy than i was back in may, right? i'd sure like to think so...maybe someday i'll be able to understand stuff like this...

What's the scope of a for loop declaration?

C++ allows identifiers to be declared in for loops. For instance, consider numsides in line A below. In pre-Standard C++ specifications, the scope of such an identifier continued to the end of the block that the for loop was declared in. Therefore, to be able to interrogate numsides on line B was ok under those rules. #include int main() { const int maxsides = 99; for (int numsides = 0; numsides < maxsides; numsides++) { // A if (...SomeCondition...) break; // blah blah } if (numsides != maxsides) // B std::cout << "Broke out of loop "; return 0; } However, toward the end of the standardization process, related to some other rules (about conditional declarations in general), the committee decided that the scope of the identifier should only be within the for, therefore, line B is an error accto Standard C++. Note that some compilers have a switch to allow old style code to continue to work. For instance, the transition model switch is --old_for_init under Comeau C++. In order for line B to work under Standard C++, line A needs to be split into two lines: int numsides; for (numsides = 0; numsides < maxsides; numsides++) { // revised line A Here numsides is in scope till the end of its block, having nothing to do with the for as far as the compiler is concerned, which is "as usual". And of course, you can always introduce another brace enclosed block if you want to constrain the scope for some reason: // ...code previous... { int numsides; for (numsides = 0; numsides < maxsides; numsides++) { // ... } // end of for loop } // scope of numsides ends here // .. rest of code... Finally, consider this code: #include int numsides = 999; // C int main() { const int maxsides = 99; for (int numsides = 0; numsides < maxsides; numsides++) { if (...SomeCondition...) break; // blah blah } if (numsides == maxsides) // B: refers to ::numsides std::cout << "Broke out of loop "; return 0; } Here, line B is ok because although the local numsides from the for loop is out of scope, it turns out that the global numsides from line C is still available for use. As a QoI (Quality of Implementation) issue, a compiler might emit a warning in such a case. For instance, Comeau C++ generates the following diagnostic when --for_init_diff_warning is set: warning: under the old for-init scoping rules variable "numsides" (the one declared at line 2) -- would have been variable "numsides" (declared at line 6) Too, try to name your identifiers better, and perhaps they will have less chance of clashing like this anyway. Also, in some cases, you may have code something like this: for (int numsides = 0; numsides < maxsides; numsides++) // D ; // numsides should be out of scope here // create another, different, numsides for (int numsides = 0; numsides < maxsides; numsides++) // E ; The numsides from line D can not be in scope in order for line E to work. Which is fine with Standard C++, as it won't be. However, you may be using it with a compiler that doesn't support the proper scoping rules, or for some reason, has disabled them. As a short term solution, you may want to consider the following hackery (think about how it'll limit the scope): #define for if(0);else for Depending upon your compiler, these forms may or may not be better: #define for if(0) { } else for #define for if(false) { } else for Of course, technically, as per Standard C++, redefining a keyword is illegal, but few compilers (if any) will actually diagnose this as a problem. As well, for a totally different take on the subject, as shown slightly different above, you can add an extra set of braces around the code { for (int numsides = 0; numsides < maxsides; numsides++) // F ; } { for (int numsides = 0; numsides < maxsides; numsides++) // G ; } You can also of course add additional identifiers: for (int numsides = 0; numsides < maxsides; numsides++) // H ; for (int numsides2 = 0; numsides2 < maxsides; numsides2++) // I ; None of these are optimal for normal code and perhaps not even good short term solutions, but if you have an old compiler, you may have no choice.

did you enjoy your little nap? i know i did...

ok, let's see how much of my list i actually get done in the next two days...wish me luck! talk to ya later, michael

<- previous ~ next ->

navigation