- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I dunno, but her List sure was Hot.
Admin
158 items on the stack, If they were all pointers (assuming that VB passes pointers as args (I wouldn't put it pass microsoft to make a copy of the item on the stack), and assuming that it's a 32-bit machine), were looking at 158*4=632 bytes on the stack and that's just in calling the function (let alone the any local variables or the stack frame). Now imagine this function being recursive.
Admin
Do we have any moderators on this site? I'm fed up of all the idiots.
Anyway, cute code:
int kittens = fuzz / claws;
Admin
Yeah course teaching WTF, regular news. I failed my Fortran course at Uni. They didn't ask 'what flavour of fortran?' so I declared 'ANSI 77 standard' and wrote to that. Got 35% 'coz none of it compiled on the very badly defined VAX compiler (code samples typed by the data-prep dept including transcription errors).
Where's the WTF in that you may ask?
Why, the tutor spoke no english and reverted to a series of video tapes. Examples were entered partly real-time by a young programmer who everyone in the class should have recognised - ME! In fact I helped to write the course material in the first place (on a true '77 compiler). On appeal I got 99% due to a spelling mistake. Horrifyingly some of the students on that course went on to military and civilian embedded systems.......
Admin
I hope...
Admin
Can I ask why you didn't know which compiler they were running. And if you weren't told, why didn't you ask?
Admin
Oh no, not 632 bytes! At that rate, if this function were recursive, you could run out of memory with a depth of just 424,739 calls!
Ever seen this:?
Not that that's a good practice, but declaring bunches of variables has much bigger problems than the memory it uses.
(Since VB is a garbage collected language, I'm assuming that it declares locals on the heap. If you were on the rediculously small Windows C stack, yes, you would blow your stack faster.)
Admin
that's based on a 256_MB_ stack. The default stack size that IIS gives each process is 256_KB_ (based on this KB article) which means that there can only be 414 depth of calls. Which is still a lot in anybodys books. But what I was tring to point out is that I consider this function to memory hungry.
But is the above code considered to be a good practice when within a recursive function?
Admin
men cant decorate a house women cant code
Admin
Not necessarily. The compiler might have optimized the entire sub away. (I think even VBScript compiles to some kind of a bytecode internally, no?)
Admin
And after some time carting rubbish and making coffee, their skills as bricklayers improve? How?
Admin
Clit 'ems! They plump when you ***k 'em!
Perhaps her best area was her stacks. You know, push down, pop up, push down, pop up....
(OK, OK, I know, that was completely out of line.)
Admin
Admin
Just out of curiosity. How big is the address space?
Admin
The real WTF is that this cheap-ass startup was using unpaid intern labor illegally. Legitimate unpaid internships are available only to college students in exchange for college credit, and they're supposed to be watch-and-learn experiences. This type of internship is not supposed to provide any benefit to the company other than props for good corporate citizenship and possibly the advantage of identifying future talent that can be hired after graduation.
Outside of this narrow scope, unpaid internships in the private sector are illegal under Federal minimum wage laws.
Admin
At least it was dimmed, we had a guy who would've done this but just randomly created the variables anywhere in the code.
Admin
VB is Evil, nuf said
Admin
Ha, foolish girl trying to declare her variables in a subroutine. That is not how it's done! You must create an include file. <!--#include file="../../dim_clit.asp"--> where the vars are declared globally. Then just include that file on every page that needs one of your variables such as CurrentUser, pageColor, or Completed. This will wreak maximum havok on your fellow programmers.
Admin
This reminds me of a co-op student I hired (many years and companies ago). I had him write a program do some fairly simple processing of text files.
When he was done, I took a look at his code, which was reasonably well structured except for the fact that he had made every single variable a global. So there I was, looking at about twenty functions which were all using the same set of roughly twenty variables. So, I though I would help him out a bit and had a discussion with him about using local variables.
He "rewrote" the program and showed me the results. He had simply taken all those global variables and made them local to main(). He then passed that same long list of variables as parameters to every function in the program.