- 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
We have to do that. There's just too much time involved to convert everything to fully standard compilers. One is an older version of VisualStudio. The VisualStudio could be upgraded for everyone, but it's a hassle. The other compiler is trickier, since upgrading it means changing a lot of startup and run time library support code. We're going to GCC for newer projects, and there's a low priority task to port the older projects to it over time.
New projects have the luxury of starting things right. But I've been on projects where a decade old code base lived through several significant changes in the C++ language; and upgrading to a newer version of the compiler was a couple of months work. You can't really point them finger at them and claim that they were shortsighted by using a 1980's era compiler in the 80's.
Admin
Team members communicating with each other?? That's crazy talk!
Admin
This is very useful behavior when you use preprocessor macros. It allows construction of string literals from multiple parts at compile time, rather than building them at runtime using sprintf. It's also useful for breaking up long strings so they're more readable in the editor. The syntax could be better perhaps, but there are already enough operators in C.
Admin
They do if you're limited to (for example) a single 16K memory page for all your video memory.
I'll use the Amstrad CPC, because it's what I learned to code on:
MODE 0: 160 × 200 × 4-bit colour <= 16K
MODE 1: 320 × 200 × 2-bit colour <= 16K
MODE 2: 640 × 200 × 1-bit colour <= 16K
I bet you're expecting that those four bits were neatly packed two pixels to a byte, aren't you? No such luxury.
I know that you personally might not have to pay much attention to it now that resolution is pretty much only limited by your monitor, but there is always an upper bound on (hres × vres × bpp).
Admin
I dunno, what part of "file scope" did you miss?
Admin
Which is truly remarkable, because nobody else's Spectrum did...
Admin
Admin
Hell, even my Vic 20 had Else in it's basic...
Just WOW.
Admin
not unless it was running a later version than the C64
Admin
They were packed two pixels to a byte. Ok, the encoding was a little quirky, but I've seen worse.
Admin
Oh, wait. Yes, you're right. Sorry, it's been a while since Z80 assembler and my battered copy of SOFT968. I think in my head I was intending 'neatly' to mean the most and least significant four bits corresponding to the left and right pixels.
Of course, the truly inexplicable part was that, whatever mode one was in, the screen was addressed as if its actual resolution was 640 × 480.
Admin
You don't have to go that far back to show the intimate relationship between resolution and color depth.
It wasn't all that long ago (oh, alright, 10+ years) that a graphics card with a 4MB frame buffer was $500. The more typical 1MB cards could handle 24-bit color at 640x480 only (and that only with packed pixels). If you wanted something crazy, like a massive 1024x768 screen, you were stuck with 256 colors. This was when 16MB of RAM cost about $600. I had a kickin' 486 back then, with $1200 worth of RAM and $500 worth of graphics, among other expensive parts that seem obscene today.
Admin
Can people start thinking at least 3 seconds before making stupid sarcastic replies? _filename_h_ is reserved at file scope. So you're allowed to use it as a local variable name but not as a macro name because then it would conflict with file scope names. Get it?
Admin
But ironic replies are ok, huh? :-)
identifier != macro
Admin
except (as has already been mentioned 500 times) that that will crash if CONFIG_STRING contains %s...
Replace printf with puts and you are ok...
Admin
qbasic definitely had else blocks, I remember using them all the time. I actually thought that if then... goto was memory-inefficient anyhow. I've just entered an if block, and now i'm leaving in the middle of it to go run code somewhere else? Alsome!
Admin
There's also the fact that preprocessor macros are not the same thing as identifiers; the rule quoted above doesn't apply to macros at all. The person who originally posted that rule also posted the rule about reserved macro names, but that got clipped in the quoting; basically, reserved macros either begin with two leading underscores or a leading underscore and an uppercase letter. Macro names that begin with an underscore followed by a lowercase letter are not reserved.
captcha = stfu; damn straight.
Admin
Continuing the above chain...
The concept of scope doesn't apply to preprocessor macros at all. Preprocessor macros are not identifiers, and the rules for identifiers don't apply to them.
_filename_h_ is not reserved. __filename_h or _Filename_h or _FILENAME_H_ would be, however.
Admin
Need to correct myself. The concept of scope does indeed apply to macros, but not the same way as it applies to identifiers. Macros are scoped to the file in which they're defined, from the #define directive until either the end of the file or an explicit #undefine directive.
Admin
The junior college I went to used part time instructors...
which is the only reason I learned about the Else statement. The instructor informed us that the Fortran emulator or compiler we had didn't recognize Else, but this is how it would work if it did...
Admin
#error a simple error directive wouldn't hurt, though
Admin
It is effectively also reserved due to the following conflict:
#define _macro_
#include <file_that_uses_global_identifier_macro_.h>
// Ooop! Screwed up!
Admin
Or he could have just done it in one line: printf("configuration: %s\n", CONFIG_STRING);
Admin
That could easily have been me. I do this all the time to avoid using negative logic in CONDITION. It's normally a
lot easier for readers of the code to understand positively-stated conditional expressions. Using the above form lets
me cleanly express the condition but take action only when it is negated.
Admin
There's room for implementations to differ, but at least for gcc 3.4.4 on i386, this is incorrect; the three strings are
concatenated at compile time; only one string results in the executable image.
Admin
Sorry; if I read the quoted part differently, my previous comment is irrelevant. It is true that if you delete the GCC part
of the clause, the binary size will increase. Not only would the three strings be allocated separately, but there would
be 3 function-invocation code sequences vice 1.
Admin
Admin
And games like Lemonade in turn came from the minicomputer world of the 1970s. Many of the classics were found in the book 101 BASIC Computer Games, written by David H. Ahl and published in 1973 by Digital Equipment Corporation. Anyone remember Lunar Lander?
And getting back to the lack of an ELSE clause in early versions of BASIC: take a look at this page from a later (1978) version of Ahl's book, which describes differences between "normal" BASIC and the then-new Microsoft 8080 BASIC running on an Altair 8800.
Note that "normal" (i.e. Dartmouth) BASIC only supported one form of the IF ... THEN statement:
IF condition THEN linenumber
Microsoft added the alternative form
IF condition THEN executable statement(s)
However, neither version provided an ELSE clause.
Admin
300 baud? You were so spoiled. Ours ran at 110 baud (that's 10 characters per second). And we dialed in using a rotary dial telephone, and a modem with an acoustic coupler (directly connecting non-Bell equipment to Ma Bell's precious phone lines being verboten in the 1970s.
We had an entire school district running off a single timesharing system, a PDP-8 minicomputer. Main memory (core, as in magnetic core, not semiconductor RAM) was 6 banks, each 4K words of 12 bits each (the operating system ran in two banks, and the users took turns getting swapped into the other four). Our "mass storage" device was a single-platter 14-inch disk drive with fixed heads (which at least made for fast access since seek time was zero). It's hard to believe now, but that system could handle up to sixteen simultaneous users.
I learned to program on that system - Basic and assembler. Fond memories, especially of the sound of those teletypes kachugging away, and the smell of warm machine oil. And saving my programs by punching them onto paper tape (again at 10cps). Still have a box of them tucked away somewhere.
Admin
My copy of K&R is at home so I can't look this up. I do remember specifically setting compiler options controlling short circuit evaluaton on a Microsoft C product circa 1990.
My guess is that the spec was ambiguous on short circuit evaluation, that it was left to be implementation dependent, or that many common implementations diverged from the spec. Regardless, no decent programmer would needlessly rely on functionality that was of limited benefit and is implementation specific. Old habits die hard, so it is not common to see the idiom today.
Admin
(Wow, you have a lot of spam piling up there.)
The first part of this "We Have Met the Enemy" (with the lousy VB code) is from me. The company is "Main Sequence Technologies" based in Willoughby, OH.
The post was referring to their flagship product "PC Recruiter" which is a buggy half-assed program (even according to some of their own developers) that deals with managing the hiring process.
One of the company's four owners, Bill Kubichek (head of sales) has even been known to go around bragging about being a spammer. Bill also spends most of his time in Hawaii doing god knows what.
If you haven't noticed, I've gotten tired of protecting this worthless company's identity. I've got another job lined up so I'm not worried about getting canned at this one.
Admin
this article reminded me of a story i read somewhere, probably on this site: a programmer never heard of the "end " command, or was it the "return" command, and instead used an intentional "divide by zero" error!