snippets.rat

来自「国外网站上的一些精典的C程序」· RAT 代码 · 共 87 行

RAT
87
字号
                        SNIPPETS Rationale                        ------------------Where do SNIPPETS come from?I'm constantly on the lookout for new SNIPPETS material. The goal of SNIPPETShas been to collect useful pieces of code that would be free for reuse. Thislimits consideration to code that is either explicitly in the public domainor which carries a free use license with few or no restrictions which wouldprevent its use. Current SNIPPETS material has been collected from theFidoNet C_Echo, comp.lang.c on the Internet, various public domain archives,and my own commercial library (MFL).How are SNIPPETS selected?As the collection has evolved, it's taken on distinguishing characteristicsbased largely, I'm afraid, on what sorts of things interest me. A primaryfocus of SNIPPETS is portability - first of all between DOS compilers, andsecondly with the larger world of Unix and other platforms. I tend to beinterested in the same problem domain as Posix - system and utilityfunctions. What I'm not interested in trying to include are things whichreally require massive amounts of code to do right (e.g.  GUIs, databases,interrupt-driven comm I/O, game-quality graphics, multimedia, etc.) and aretherefore better addressed by large single-purpose packages, whethercommercial or otherwise.In addition to the utility stuff, I also snag anything that seems moderatelyobscure (e.g. ISBN validation, wind chill, sunrise/set time, etc.) Whether Ineed to know these things or not, someone sometime will need to be able to dothese and I like to be able to provide the option of a simple canned solutionrather than sending them on a research spree.What makes one SNIPPETS entry "better" than other candidates?Anything that enhances portability or usability is better in my book. Notethat I'm not necessarily soliciting completion to full library standards. Asthe name SNIPPETS implies, many of the entries knowingly have minimalbullet-proofing. Most of the entries I've excerpted from MFL differ only inthat my commercial code provides bullet-proof error trapping at the cost ofslightly obfuscating the algorithms. In cases where error trapping would, inmy opinion, make the algorithm harder to follow, I've generally opted forclarity over safety. This was a conscious decision since the target audiencefor SNIPPETS includes both newbies and experienced programmers. The pros willrecognize the shortcomings and know to add the error trapping, but the tyroscan tend to get lost. My yardstick on this has been feedback. If too manytyros have to ask how it works, then I try to simplify and/or make theunderlying algorithm stand out. If too many folks complain about it beingunsafe, I add more bullet-proofing. When I hear as little from both sides aspossible, I figure I've achieved the desired balance. Is the SNIPPETS collection only for PC's?No. More and more portable code has been introduced into the collection overthe years so that now there is more portable code (although some will requireminor work) than PC-specific code. Beginning with the October, 1995 release,operating system and/or environmental dependencies are listed in the SNIPPETSmaster index file, SNIPPETS.NDX. Beginning with the same release, SNIPPETStesting has become more thorough with the goal of verifying portabilityclaims. The current testing regimen seeks to assure a minimum level ofportability between all major DOS/Windows compilers, extended DOS, OS/2,Linux, and as many Unix systems as I can find with people willing to test(currently I have testers signed up using HP/UX, Solaris, AIX, and Linux).Increased testing is also underway under Win 32 (Windows 95 & NT), with moreadded all the time.Is SNIPPETS only a collection of C code?No. There have always been a few PC-specific assembly routines in SNIPPETS,and the current collection includes a growing number of reusable C++ classes.In some cases, SNIPPETS includes both a C and C++ solution to a particularprogramming question.Bob StoutFidoNet:    1:106/2000.6            C_Echo moderator (1990-1991, 1996-1997)Internet:   rbs@snippets.org            rbs@brokersys.comSnailMail:  MicroFirm            P.O. Box 428            Alief, TX 77411

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?