|
Home | Switchboard | Unix Administration | Red Hat | TCP/IP Networks | Neoliberalism | Toxic Managers |
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and bastardization of classic Unix |
|
|
It's a small C program. I know, I know, it doesn't look like it's gonna get compiled, but believe me, it does. Try to guess this program's output, then try to run it. You'll be amazed to see what it does!
Here's the program in a normal text file .
#include <stdio.h> main(t,_,a)char *a;{return!0<t?t<3?main(-79,-13,a+main(-87,1-_, main(-86,0,a+1)+a)):1,t<_?main(t+1,_,a):3,main(-94,-27+t,a)&&t==2?_<13? main(2,_+1,"%s %d %d\n"):9:16:t<0?t<-72?main(_,t, "@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#\ ;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l \ q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# \ ){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' \ iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \ ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n' ')# \ }'+}##(!!/") :t<-50?_==*a?putchar(31[a]):main(-65,_,a+1):main((*a=='/')+t,_,a+1) :0<t?main(2,2,"%s"):*a=='/'||main(0,main(-61,*a, "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}
Dennis Ritchie, renowned author of the C programming language, obligingly responded to our query as follows:
I don't usually answer this kind of request; various Who's Who compilers have gone unrequited. Nevertheless,
- What is your programming language of choice?
Alef- What is your favorite operating system?
Plan 9- Do you have a hero or role model?
I follow my nephew's advice. He advises me that Power Rangers are getting tired..- What is your favorite kind of music?
That which is is just past the earliest of its kind.- What is your favorite news group?
They are pretty much all the same.- What is your favorite web page (besides geekchic!)?
http://www.cen.uiuc.edu/cgi-bin/ryl (now broken, sorry!)- What sports do you enjoy?
Mouth-breathing- What kind of car do you drive?
1985 VW GTI- What hobbies do you enjoy outside of work?
Brooding- What is your favorite book (or author)?
S. J. Perelman- What is your favorite movie?
Dr. Strangelove, or: How I Learned to Stop Worrying and Love the Bomb- What sort of clothing do you usually wear to work?
Black jeans, shirt with collar- What is your favorite food?
My own
- Thou shalt run lint frequently and study its pronouncements with care, for verily its perception and judgement oft exceed thine.
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end.
- Thou shalt cast all function arguments to the expected type if they are not of that type already, even when thou art convinced that this is unnecessary, lest they take cruel vengeance upon thee when thou least expect it.
- If thy header files fail to declare the return types of thy library functions, thou shalt declare them thyself with the most meticulous care, lest grievous harm befall thy program.
- Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
- If a function be advertised to return an error code in the event of difficulties, thou shalt check for that code, yea, even though the checks triple the size of thy code and produce aches in thy typing fingers, for if thou thinkest ``it cannot happen to me'', the gods shall surely punish thee for thy arrogance.
- Thou shalt study thy libraries and strive not to reinvent them without cause, that thy code may be short and readable and thy days pleasant and productive.
- Thou shalt make thy program's purpose and structure clear to thy fellow man by using the One True Brace Style, even if thou likest it not, for thy creativity is better used in solving problems than in creating beautiful new impediments to understanding.
- Thy external identifiers shall be unique in the first six characters, though this harsh discipline be irksome and the years of its necessity stretch before thee seemingly without end, lest thou tear thy hair out and go mad on that fateful day when thou desirest to make thy program run on an old system.
- Thou shalt foreswear, renounce, and abjure the vile heresy which claimeth that ``All the world's a VAX'', and have no commerce with the benighted heathens who cling to this barbarous belief, that the days of thy program may be long even though the days of thy current machine be short.
Addendum - How to write in C
- Rewrite standard functions and give them your own obscure names.
- Use obscure, proprietary, non-portable, compiled library packages so that you never have to move from the platform you love so well.
- Use very descriptive comments like:
/* printf("Hello world\n"); */
before each function call- Remember:
- Carriage returns are for weenies.
- tabs are for those who have not reached weenie-dom yet.
- Include *LOTS* of inline assembly code.
- "User Interfaces" are for morons. "Users" have no business interfacing with a professional product like yours.
- If you are forced to comment your code (in English), then borrow comments from somebody else's code and sprinkle them throughout yours. It's quick, easy, and fun to watch people's expressions as they try to figure it out.
- Remember to define as many pre-processor symbols as possible in terms of already defined symbols. This is considered 'efficient use of code'.
- Assume the compiler takes care of all the little details you didn't quite understand.
Addendum - How to debug C code
- Since you got it to compile, the problem must be in the Other Guys Code.
- If it's all your code then the problem *MUST* be in those unreliable Standard Libraries. See '1.' in the previous section.
- Claim the bug reports are vicious lies meant to tarnish your sterling reputation as a 'C' programmer (well aren't they?). After all, those who wrote the reports couldn't even *read* your code. How could they possibly know if there was a bug or not?
- If they could read your code, review "How to write in C", above.
- Claim that there wouldn't be a problem if this stingy Company/School/Wife/etc would spring for a copy of C++.
- Insert/remove blank lines at random spots, re-compile, and execute.
- If it still doesn't work, re-write it in assembler. This won't fix the bug, but it will make sure no one else finds it and makes you look bad.
When I find my code in tons of trouble,
Friends and colleagues come to me,
Speaking words of wisdom:
"Write in C."
As the deadline fast approaches,
And bugs are all that I can see,
Somewhere, someone whispers"
"Write in C."
Write in C, write in C,
Write in C, write in C.
LISP is dead and buried,
Write in C.
I used to write a lot of FORTRAN,
for science it worked flawlessly.
Try using it for graphics!
Write in C.
If you've just spent nearly 30 hours
Debugging some assembly,
Soon you will be glad to
Write in C.
Write in C, write in C,
Write In C, yeah, write in C.
Only wimps use BASIC.
Write in C.
Write in C, write in C,
Write in C, oh, write in C.
Pascal won't quite cut it.
Write in C.
Guitar Solo
Write in C, write in C,
Write in C, yeah, write in C.
Don't even mention COBOL.
Write in C.
And when the screen is fuzzy,
And the edior is bugging me.
I'm sick of ones and zeroes.
Write in C.
A thousand people people swear that T.P.
Seven is the one for me.
I hate the word PROCEDURE,
Write in C.
Write in C, write in C,
Write in C, yeah, write in C.
PL1 is 80's,
Write in C.
Write in C, write in C,
Write in C, yeah, write in C.
The government loves ADA,
Write in C.
When I find my code in tons of trouble,
Friends and colleagues come to me,
Speaking words of wisdom:
"Write in C."
Write in C, Write in C,
Write in C, oh, Write in C.
LOGO's dead and buried,
Write in C.
I used to write a lot of FORTRAN,
For science it worked flawlessly.
Try using it for graphics!
Write in C.
If you've just spent nearly 30 hours
Debugging some assembly,
Soon you will be glad to
Write in C.
Write in C, Write in C,
Write in C, yeah, Write in C.
Only wimps use BASIC.
Write in C.
Write in C, Write in C
Write in C, oh, Write in C.
Pascal won't quite cut it.
Write in C.
Write in C, Write in C,
Write in C, yeah, Write in C.
Don't even mention COBOL.
Write in C.
The International
Obfuscated C Code Contest -- classic source of joy for C programmers
;-)
The Bug Count Also Rises by John Browne (Imitation Hemingway Contest Winner). This work is licensed under a Creative Commons Attribution - NonCommercial - NoDerivs 2.5 License.
In the fall of that year the rains fell as usual and washed the leaves of the dust and dripped from the leaves onto the ground. The shuttles drove through the rainy streets and took the people to meetings, then later brought them back, their tires spraying the mist into the air.Many days he stood for a long time and watched the rain and the shuttles and drank his double-tall mochas. With the mochas he was strong.
Hernando who worked down the hall and who was large with microbrews came to him and told him that the ship day was upon them but the bugs were not yet out. The bugs which were always there even when you were in Cafes late at night sipping a Redhook or a double-tall mocha and you thought you were safe but they were there and although Enrico kept the floor swept clean and the mochas were hot the bugs were there and they ate at you.
When Hernando told him this he asked how many bugs. "The RAID is huge with bugs," Hernando said. "The bugs are infinite."
"Why do you ask me? You know I cannot do this thing anymore with the bugs."
"Once you were great with the bugs," Hernando said. "No one was greater," he said again. "Even Prado."
"Prado? What of Prado? Let Prado fix the bugs."
Hernando shrugged. "Prado is finished. He was gored by three Sev 2's on Chicago. All he does now is drink herb tea and play with his screensavers."
"Herb tea?"
"It is true, my friend." Hernando shrugged again. Later he went to his office and sat in the dark for a long time. Then he sent e-mail to Michaels.
Michaels came to him while he was sipping a mocha. They sat silently for awhile, then he asked Michaels, "I need you to triage for me."
Michaels looked down. "I don't do that anymore," he said.
"This is different. The bugs are enormous. There are an infinity of bugs."
"I'm finished with that," Michaels said again. "I just want to live quietly."
"Have you heard Prado is finished? He was badly gored. Now he can only drink herb tea."
"Herb tea?" Michaels said.
"It is true," he said sorrowfully.
Michaels stood up. "Then I will do it, my friend," he said formally. "I will do it for Prado, who was once great with the bugs. I will do it for the time we filled Prado's office with bouncy balls, and for the time Prado wore his nerf weapons in the marketing hall and slew all of them with no fear and only a great joy at the combat. I will do it for all the pizza we ate and the bottles of Coke we drank."
Together they walked slowly back, knowing it would be good. As they walked the rain dripped softly from the leaves, and the shuttles carried the bodies back from the meetings.
Computer Quotes gathered on the Net
"It's 5.50 a.m.... Do you know where your stack pointer is ?"
C /n./: A programming language that is sort of like Pascal except more like assembly except that it isn't very much like either one, or anything else. It is either the best language available to the art today, or it isn't.
Ray Simard.
"If it wasn't for C, we'd be writing programs in BASI, PASAL, and OBOL."
"I have yet to meet a C compiler that is more friendly and easier to use than eating soup with a knife."
"In My Egotistical Opinion, most people's C programs should be indented six feet downward and covered with dirt." Blair P. Houghton.
"Going from programming in Pascal to programming in C, is like learning to write in Morse code." J.P. Candusso.
"Trying to outsmart a compiler defeats much of the purpose of using one." Kernighan & Plauger, The Elements of Programming Style.
"I will not be a lemming and follow the crowd over the cliff and into the C." John (Jack) Beidler.
"Because we are returning a copy for postfix ++ expressions, statements such as (c++)++; won't work as expected." Weiskamp & Flamig, The Complete C++ Primer.
"Evolution of the C programmer: Richard Heathfield.
- 0 months to 1 month: complete beginner
- 1 month to 1 year: incomplete beginner
- 1 year to 2 years: acolyte
- 2 years to 3 years: adept
- 3 years to 8 years: expert
- at 8 years: discovers comp.lang.c
- 8 years+: buggrit, back to beginner again !"
"... one of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs." Robert Firth.
"I've never met anyone responsible for C language code maintenance who speaks well of the C Language.
Anyone out there who LIKES to maintain C code ?" Ted Dennison.
"C is quirky, flawed, and an enormous success." Dennis M. Ritchie.
"A C program is like a fast dance on a newly waxed dance floor by people carrying razors." Waldi Ravens.
"The C Programming Language A language which combines the flexibility of assembly language with the power of assembly language."
"The more I C, the less I see."
"There are two major products that come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence." Jeremy S. Anderson
"I liken starting one's computing career with Unix, say as an undergraduate, to being born in East Africa. It is intolerably hot, your body is covered with lice and flies, you are malnourished and you suffer from numerous curable diseases. But, as far as young East Africans can tell, this is simply the natural condition and they live within it. By the time they find out differently, it is too late. They already think that the writing of shell scripts is a natural act." Ken Pier, Xerox PARC.
"The original Unix solved a problem and solved it well, as did the Roman numeral system, the mercury treatment for syphilis, and carbon paper."
"Confucius say: He who play in root, eventually kill tree."
"To err is human... to really foul up requires the root password."
"Unix is the answer, but only if you phrase the question very carefully."
"19 Jan 2038 at 3:14:07 AM" The end of the word according to Unix (232 seconds after Jan 1st 1970).
"Unix is user-friendly. It's just very selective about who its friends are."
"UNIX: It's not just 'User-Unfriendly', it's 'Proactively User-Hostile' !"
"Programming graphics in X is like finding sqrt(pi) using Roman numerals. "
"The number of the beast vi vi vi."
"In years past, I knew of someone who used emacs as his login shell, the only thing he found wanting in emacs was a good text editor. So he ended up using vi." Anonymous
"VMS is a text-only adventure game. If you win you can use unix." W. Davidson.
"The big difference between UNIX and VMS:
To do anything on UNIX, you need to know an obscure command.
To do anything on VMS, you need to know an obscure option to SET."
C++ in Cantonese is pronounced "C ga ga".
Need I say more? (Mark Glewwe)
The Ten Commandments for C Programmers
(Annotated Edition)
Henry Spencer
I. Thou shalt run lint frequently and study its pronouncements with care, for verily its perception and judgement oft exceed thine.
This is still wise counsel, although many modern compilers search out many of the same sins, and there are often problems with lint being aged and infirm, or unavailable in strange lands. There are other tools, such as Saber C, useful to similar ends.
``Frequently'' means thou shouldst draw thy daily guidance from it, rather than hoping thy code will achieve lint's blessing by a sudden act of repentance at the last minute. De-linting a program which has never been linted before is often a cleaning of the stables such as thou wouldst not wish on thy worst enemies. Some observe, also, that careful heed to the words of lint can be quite helpful in debugging.
``Study'' doth not mean mindless zeal to eradicate every byte of lint output--if for no other reason, because thou just canst not shut it up about some things--but that thou should know the cause of its unhappiness and understand what worrisome sign it tries to speak of.
II. Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end.
Clearly the holy scriptures were mis-transcribed here, as the words should have been ``null pointer'', to minimize confusion between the concept of null pointers and the macro NULL (of which more anon). Otherwise, the meaning is plain. A null pointer points to regions filled with dragons, demons, core dumps, and numberless other foul creatures, all of which delight in frolicing in thy program if thou disturb their sleep. A null pointer doth not point to a 0 of any type, despite some blasphemous old code which impiously assumes this.
III. Thou shalt cast all function arguments to the expected type if they are not of that type already, even when thou art convinced that this is unnecessary, lest they take cruel vengeance upon thee when thou least expect it.
A programmer should understand the type structure of his language, lest great misfortune befall him. Contrary to the heresies espoused by some of the dwellers on the Western Shore, `int' and `long' are not the same type. The moment of their equivalence in size and representation is short, and the agony that awaits believers in their interchangeability shall last forever and ever once 64-bit machines become common.
Also, contrary to the beliefs common among the more backward inhabitants of the Polluted Eastern Marshes, `NULL' does not have a pointer type, and must be cast to the correct type whenever it is used as a function argument.
(The words of the prophet Ansi, which permit NULL to be defined as having the type `void *', are oft taken out of context and misunderstood. The prophet was granting a special dispensation for use in cases of great hardship in wild lands. Verily, a righteous program must make its own way through the Thicket Of Types without lazily relying on this rarely-available dispensation to solve all its problems. In any event, the great deity Dmr who created C hath wisely endowed it with many types of pointers, not just one, and thus it would still be necessary to convert the prophet's NULL to the desired type.)
It may be thought that the radical new blessing of ``prototypes'' might eliminate the need for caution about argument types. Not so, brethren. Firstly, when confronted with the twisted strangeness of variable numbers of arguments, the problem returns... and he who has not kept his faith strong by repeated practice shall surely fall to this subtle trap. Secondly, the wise men have observed that reliance on prototypes doth open many doors to strange errors, and some indeed had hoped that prototypes would be decreed for purposes of error checking but would not cause implicit conversions. Lastly, reliance on prototypes causeth great difficulty in the Real World today, when many cling to the old ways and the old compilers out of desire or necessity, and no man knoweth what machine his code may be asked to run on tomorrow.
IV. If thy header files fail to declare the return types of thy library functions, thou shalt declare them thyself with the most meticulous care, lest grievous harm befall thy program.
The prophet Ansi, in her wisdom, hath added that thou shouldst also scourge thy Suppliers, and demand on pain of excommunication that they produce header files that declare their library functions. For truly, only they know the precise form of the incantation appropriate to invoking their magic in the optimal way.
The prophet hath also commented that it is unwise, and leads one into the pits of damnation and subtle bugs, to attempt to declare such functions thyself when thy header files do the job right.
V. Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpiali- docious''.
As demonstrated by the deeds of the Great Worm, a consequence of this commandment is that robust production software should never make use of gets(), for it is truly a tool of the Devil. Thy interfaces should always inform thy servants of the bounds of thy arrays, and servants who spurn such advice or quietly fail to follow it should be dispatched forthwith to the Land Of Rm, where they can do no further harm to thee.
VI. If a function be advertised to return an error code in the event of difficulties, thou shalt check for that code, yea, even though the checks triple the size of thy code and produce aches in thy typing fingers, for if thou thinkest ``it cannot happen to me'', the gods shall surely punish thee for thy arrogance.
All true believers doth wish for a better error-handling mechanism, for explicit checks of return codes are tiresome in the extreme and the temptation to omit them is great. But until the far-off day of deliverance cometh, one must walk the long and winding road with patience and care, for thy Vendor, thy Machine, and thy Software delight in surprises and think nothing of producing subtly meaningless results on the day before thy Thesis Oral or thy Big Pitch To The Client.
Occasionally, as with the ferror() feature of stdio, it is possible to defer error checking until the end when a cumulative result can be tested, and this often produceth code which is shorter and clearer. Also, even the most zealous believer should exercise some judgement when dealing with functions whose failure is totally uninteresting... but beware, for the cast to void is a two-edged sword that sheddeth thine own blood without remorse.
VII. Thou shalt study thy libraries and strive not to reinvent them without cause, that thy code may be short and readable and thy days pleasant and productive.
Numberless are the unwashed heathen who scorn their libraries on various silly and spurious grounds, such as blind worship of the Little Tin God (also known as ``Efficiency''). While it is true that some features of the C libraries were ill-advised, by and large it is better and cheaper to use the works of others than to persist in re-inventing the square wheel. But thou should take the greatest of care to understand what thy libraries promise, and what they do not, lest thou rely on facilities that may vanish from under thy feet in the future.
VIII. Thou shalt make thy program's purpose and structure clear to thy fellow man by using the One True Brace Style, even if thou likest it not, for thy creativity is better used in solving problems than in creating beautiful new impediments to understanding.
These words, alas, have caused some uncertainty among the novices and the converts, who knoweth not the ancient wisdoms. The One True Brace Style referred to is that demonstrated in the writings of the First Prophets, Kernighan and Ritchie. Often and again it is criticized by the ignorant as hard to use, when in truth it is merely somewhat difficult to learn, and thereafter is wonderfully clear and obvious, if perhaps a bit sensitive to mistakes.
While thou might think that thine own ideas of brace style lead to clearer programs, thy successors will not thank thee for it, but rather shall revile thy works and curse thy name, and word of this might get to thy next employer. Many customs in this life persist because they ease friction and promote productivity as a result of universal agreement, and whether they are precisely the optimal choices is much less important. So it is with brace style.
As a lamentable side issue, there has been some unrest from the fanatics of the Pronoun Gestapo over the use of the word ``man'' in this Commandment, for they believe that great efforts and loud shouting devoted to the ritual purification of the language will somehow redound to the benefit of the downtrodden (whose real and grievous woes tendeth to get lost amidst all that thunder and fury). When preaching the gospel to the narrow of mind and short of temper, the word ``creature'' may be substituted as a suitable pseudoBiblical term free of the taint of Political Incorrectness.
IX. Thy external identifiers shall be unique in the first six characters, though this harsh discipline be irksome and the years of its necessity stretch before thee seemingly without end, lest thou tear thy hair out and go mad on that fateful day when thou desirest to make thy program run on an old system.
Though some hasty zealots cry ``not so; the Millenium is come, and this saying is obsolete and no longer need be supported'', verily there be many, many ancient systems in the world, and it is the decree of the dreaded god Murphy that thy next employment just might be on one. While thou sleepest, he plotteth against thee. Awake and take care.
It is, note carefully, not necessary that thy identifiers be limited to a length of six characters. The only requirement that the holy words place upon thee is uniqueness within the first six. This often is not so hard as the belittlers claimeth.
X. Thou shalt foreswear, renounce, and abjure the vile heresy which claimeth that ``All the world's a VAX'', and have no commerce with the benighted heathens who cling to this barbarous belief, that the days of thy program may be long even though the days of thy current machine be short.
This particular heresy bids fair to be replaced by ``All the world's
a Sun'' or ``All the world's a 386'' (this latter being a particularly
revolting invention of Satan), but the words apply to all such without
limitation. Beware, in particular, of the subtle and terrible ``All
the world's a 32-bit machine'', which is almost true today but shall
cease to be so before thy resume grows too much longer.
Write In C
(Tune: The Beatles,"Let It Be")
When I find my code in tons
of trouble,
Friends and colleagues come to me,
Speaking words of wisdom:
"Write in C."
As the deadline fast approaches,
And bugs are all that I can see,
Somewhere, someone whispers:
"Write in C."
... ... ...
High School/Jr.High =================== # 10 PRINT "HELLO WORLD" # 20 END First year in College ===================== # program Hello(input, output) # begin # writeln('Hello World') # end. Senior year in College ====================== # (defun hello # (print # (cons 'Hello (list 'World)))) New professional ================ # #include <stdio.h # void main(void) # { # char *message[] = {"Hello ", "World"}; # int i; # # for(i = 0; i < 2; ++i) # printf("%s", message[i]); # printf("\n"); # } Seasoned professional ===================== # #include <iostream.h # #include <string.h # # class string # { # private: # int size; # char *ptr; # # public: # string() : size(0), ptr(new char('\0')) {} # # string(const string &s) : size(s.size) # { # ptr = new char[size + 1]; # strcpy(ptr, s.ptr); # } # # ~string() # { # delete [] ptr; # } # # friend ostream &operator <<(ostream &, const string &); # string &operator=(const char *); # }; # # ostream &operator<<(ostream &stream, const string &s) # { # return(stream << s.ptr); # } # # string &string::operator=(const char *chrs) # { # if (this != &chrs) # { # delete [] ptr; # size = strlen(chrs); # ptr = new char[size + 1]; # strcpy(ptr, chrs); # } # return(*this); # } # # int main() # { # string str; # # str = "Hello World"; # cout << str << endl; # # return(0); # } Master Programmer ================= # [ # uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820) # ] # library LHello # { # // bring in the master library # importlib("actimp.tlb"); # importlib("actexp.tlb"); # # // bring in my interfaces # #include "pshlo.idl" # # [ # uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820) # ] # cotype THello # { # interface IHello; # interface IPersistFile; # }; # }; # # [ # exe, # uuid(2573F890-CFEE-101A-9A9F-00AA00342820) # ] # module CHelloLib # { # # // some code related header files # importheader(<windows.h); # importheader(<ole2.h); # importheader(<except.hxx); # importheader("pshlo.h"); # importheader("shlo.hxx"); # importheader("mycls.hxx"); # # // needed typelibs # importlib("actimp.tlb"); # importlib("actexp.tlb"); # importlib("thlo.tlb"); # # [ # uuid(2573F891-CFEE-101A-9A9F-00AA00342820), # aggregatable # ] # coclass CHello # { # cotype THello; # }; # }; # # # #include "ipfix.hxx" # # extern HANDLE hEvent; # # class CHello : public CHelloBase # { # public: # IPFIX(CLSID_CHello); # # CHello(IUnknown *pUnk); # ~CHello(); # # HRESULT __stdcall PrintSz(LPWSTR pwszString); # # private: # static int cObjRef; # }; # # # #include <windows.h # #include <ole2.h # #include <stdio.h # #include <stdlib.h # #include "thlo.h" # #include "pshlo.h" # #include "shlo.hxx" # #include "mycls.hxx" # # int CHello::cObjRef = 0; # # CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk) # { # cObjRef++; # return; # } # # HRESULT __stdcall CHello::PrintSz(LPWSTR pwszString) # { # printf("%ws\n", pwszString); # return(ResultFromScode(S_OK)); # } # # # CHello::~CHello(void) # { # # // when the object count goes to zero, stop the server # cObjRef--; # if( cObjRef == 0 ) # PulseEvent(hEvent); # # return; # } # # #include <windows.h # #include <ole2.h # #include "pshlo.h" # #include "shlo.hxx" # #include "mycls.hxx" # # HANDLE hEvent; # # int _cdecl main( # int argc, # char * argv[] # ) { # ULONG ulRef; # DWORD dwRegistration; # CHelloCF *pCF = new CHelloCF(); # # hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); # # // Initialize the OLE libraries # CoInitializeEx(NULL, COINIT_MULTITHREADED); # # CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER, # REGCLS_MULTIPLEUSE, &dwRegistration); # # // wait on an event to stop # WaitForSingleObject(hEvent, INFINITE); # # // revoke and release the class object # CoRevokeClassObject(dwRegistration); # ulRef = pCF-Release(); # # // Tell OLE we are going away. # CoUninitialize(); # # return(0); # } # # extern CLSID CLSID_CHello; # extern UUID LIBID_CHelloLib; # # CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */ # 0x2573F891, # 0xCFEE, # 0x101A, # { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 } # }; # # UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */ # 0x2573F890, # 0xCFEE, # 0x101A, # { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 } # }; # # #include <windows.h # #include <ole2.h # #include <stdlib.h # #include <string.h # #include <stdio.h # #include "pshlo.h" # #include "shlo.hxx" # #include "clsid.h" # # int _cdecl main( # int argc, # char * argv[] # ) { # HRESULT hRslt; # IHello *pHello; # ULONG ulCnt; # IMoniker * pmk; # WCHAR wcsT[_MAX_PATH]; # WCHAR wcsPath[2 * _MAX_PATH]; # # // get object path # wcsPath[0] = '\0'; # wcsT[0] = '\0'; # if( argc 1) { # mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1); # wcsupr(wcsPath); # } # else { # fprintf(stderr, "Object path must be specified\n"); # return(1); # } # # // get print string # if(argc 2) # mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1); # else # wcscpy(wcsT, L"Hello World"); # # printf("Linking to object %ws\n", wcsPath); # printf("Text String %ws\n", wcsT); # # // Initialize the OLE libraries # hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED); # # if(SUCCEEDED(hRslt)) { # # # hRslt = CreateFileMoniker(wcsPath, &pmk); # if(SUCCEEDED(hRslt)) # hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello); # # if(SUCCEEDED(hRslt)) { # # // print a string out # pHello-PrintSz(wcsT); # # Sleep(2000); # ulCnt = pHello-Release(); # } # else # printf("Failure to connect, status: %lx", hRslt); # # // Tell OLE we are going away. # CoUninitialize(); # } # # return(0); # } Apprentice Hacker =================== # #!/usr/local/bin/perl # $msg="Hello, world.\n"; # if ($#ARGV = 0) { # while(defined($arg=shift(@ARGV))) { # $outfilename = $arg; # open(FILE, "" . $outfilename) || die "Can't write $arg: $!\n"; # print (FILE $msg); # close(FILE) || die "Can't close $arg: $!\n"; # } # } else { # print ($msg); # } # 1; Experienced Hacker =================== # #include <stdio.h # #define S "Hello, World\n" # main(){exit(printf(S) == strlen(S) ? 0 : 1);} Seasoned Hacker ================ # % cc -o a.out ~/src/misc/hw/hw.c # % a.out Guru Hacker ============ # % cat # Hello, world. # ^D New Manager ============ # 10 PRINT "HELLO WORLD" # 20 END Middle Manager =============== # mail -s "Hello, world." bob@b12 # Bob, could you please write me a program that prints "Hello, world."? # I need it by tomorrow. # ^D Senior Manager =============== # % zmail jim # I need a "Hello, world." program by this afternoon. Chief Executive ================= # % letter # letter: Command not found. # % mail # To: ^X ^F ^C # % help mail # help: Command not found. # % damn! # !: Event unrecognized # % logout
COMPUTERWORLD 1 April
CREATORS ADMIT UNIX, C HOAX
In an announcement that has stunned the computer industry, Ken Thompson,
Dennis Ritchie and Brian Kernighan admitted that the Unix operating
system and C programming language created by them is an elaborate April
Fools prank kept alive for over 20 years. Speaking at the recent
UnixWorld Software Development Forum, Thompson revealed the following:
"In 1969, AT&T had just terminated their work with the GE/Honeywell/AT&T
Multics project. Brian and I had just started working with an early
release of Pascal from Professor Nichlaus Wirth's ETH labs in
Switzerland and we were impressed with its elegant simplicity and
power. Dennis had just finished reading 'Bored of the Rings', a
hilarious National Lampoon parody of the great Tolkien 'Lord of the
Rings' trilogy. As a lark, we decided to do parodies of the Multics
environment and Pascal. Dennis and I were responsible for the operating
environment. We looked at Multics and designed the new system to be as
complex and cryptic as possible to maximize casual users' frustration
levels, calling it Unix as a parody of Multics, as well as other more
risque allusions. Then Dennis and Brian worked on a truly warped
version of Pascal, called 'A'. When we found others were actually
trying to create real programs with A, we quickly added additional
cryptic features and evolved into B, BCPL and finally C. We stopped
when we got a clean compile on the following syntax:
for(;P("\n"),R-;P("|"))for(e=C;e-;P("_"+(*u++/8)%2))P("| "+(*u/4)%2);
To think that modern programmers would try to use a language that
allowed such a statement was beyond our comprehension! We actually
thought of selling this to the Soviets to set their computer science
progress back 20 or more years. Imagine our surprise when AT&T and
other US corporations actually began trying to use Unix and C! It has
taken them 20 years to develop enough expertise to generate even
marginally useful applications using this 1960's technological parody,
but we are impressed with the tenacity (if not common sense) of the
general Unix and C programmer. In any event, Brian, Dennis and I have
been working exclusively in Pascal on the Apple Macintosh for the past
few years and feel really guilty about the chaos, confusion and truly
bad programming that have resulted from our silly prank so long ago."
Major Unix and C vendors and customers, including AT&T, Microsoft,
Hewlett-Packard, GTE, NCR, and DEC have refused comment at this time.
Borland International, a leading vendor of Pascal and C tools,
including the popular Turbo Pascal, Turbo C and Turbo C++, stated they
had suspected this for a number of years and would continue to enhance
their Pascal products and halt further efforts to develop C. An IBM
spokesman broke into uncontrolled laughter and had to postpone a
hastily convened news conference concerning the fate of the RS-6000,
merely stating 'VM will be available Real Soon Now'. In a cryptic
statement, Professor Wirth of the ETH institute and father of the
Pascal, Modula 2 and Oberon structured languages, merely stated that P.
T. Barnum was correct.
In a related late-breaking story, usually reliable sources are stating
that a similar confession may be forthcoming from William Gates
concerning the MS-DOS and Windows operating environments. And IBM
spokesman have begun denying that the Virtual Machine (VM) product is
an internal prank gone awry.
{COMPUTERWORLD 1 April}
{contributed by Bernard L. Hayes}
Tried to amend my low-level habits
started learning Ada last fall
Writing tasks with conditional rendez-vous calls
Raising lots'a exceptions and handling them all
But at night I had these wonderful dreams
some kind of sensuous treat
Not of subtypes or generics or packages
but of function pointers and binary trees( I was a...)
C hacker in paradise
putting my flags in an integer slice
Using K&R to be more precise
I'm just a C hacker in paradiseHeard about some of our managers
they want to do everything with a tool
Classes you browse by clicking with the mouse
Well it reminds me of some stuff I saw in primary school!
But I am not so easy to break;
When I'm at work I keep fighting back
Not with methods, drag-and-drop or a Hypercard stack
But with that miracle language in which I hack!C hacker in paradise
writing code that's already optimized
putting my flags in an integer slice
I'm just a C hacker in paradiseI write all my functions with recursion
using implicit pointer conversion
Back with a longjmp and then a goto
Oh, good God almighty which way should I goto be a
C hacker in paradise
Making all operations bitwise
Writing right onto the raw device
Yes, I'm a
C hacker in paradise
I'll be a
C hacker in paradise
I'm just a
C hacker in paradiseI write all ...
C hacker in paradise ....
I'd like to be coding in C
In the Sun Computer lab in the shade
Stay up all night, program it right
In a Sun Computer lab in the shadeI'd ask my friends to program C
in the computer lab with me
I'd like to be coding in C
In a Sun Computer lab in the shade.We've never done using the Sun
In our little hideaway making lots of fun.
banking our head until we're dead.
In a Sun Computer lab in the shade
Society
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
Quotes
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Bulletin:
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
History:
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
Classic books:
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Haters Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|
You can use PayPal to to buy a cup of coffee for authors of this site |
Disclaimer:
The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.
Last modified: March 12, 2019