BitWise wrote:
They say that if you only have a hammer then everything looks like a nail.
I've always liked this one:
Quote:
When C++ is your hammer, everything looks like your thumb.
As for macros, when in college, I basically wrote a large set of Forth macros.
Essentially, it was a Forth, but done in macros, rather than as an interpreter.
On the plus side, it made my assembly language assignments for my PDP Macro-11 class REALLY easy.
We had on assignment, for example, that we had to extract bit fields from a packed word. You know, an exercise in masking and shifting. No big deal.
Pretty sure nobody else turned one in that output the fields and values in binary and decimal (but they didn't have a BASE variable and common routines for reading and writing numbers). 2 lines of code for me!
Anyway, it was clever at the time. The macro library listing dwarfed the combined assignment listings (some of the assignments were really just 5 lines of "code").
But, boy, it sure was slow! and bloated and all sorts of horrible things lol! For one thing, I always saved and restored registers, no doubt I used more macro expansion at places I probably could have better used a subroutine, stuff like that.
It was a neat set, but made for a lousy compiler.
Was fun though, I got an A!