# Worst coding typical you've ever before needed to adhere to?

Have you ever before needed to function to coding standards that :

• Were initially consisted of forever factors yet were maintained long after the initial problem came to be unnecessary?
• Remained in a checklist as long that it was difficult to bear in mind them all?
• Made you assume the writer was simply attempting to leave their mark as opposed to motivating excellent coding technique?
• You had no suggestion why they were consisted of?

If so, what is your the very least favored regulation and also why?

Some instances here

0
2019-05-07 14:32:13
Source Share

One even more blast from my past.

Price estimate from firm proprietor :

There will certainly be no code created making use of expository languages due to the fact that I shed 25 million on that particular curse task created in Java.

The Java task was a supply trading system made to take care of a couple of loads supplies, that was currently being made use of to refine thousands. As opposed to resolving the layout imperfections or inadequate equipment, the entire firm was compelled to transform all non C/C+npls applications to C/C+npls, and also all new growth needed to remain in C/C+npls. Expository languages suggested anything not assembled, and also the proprietor just took into consideration Assembler, C and also C+npls assembled.

For an 800 individual firm, in which a lot of the code remained in Java and also Perl, this suggested the entire firm invested a lot of their time over the next number of years revising flawlessly great code in C/C+npls.

Amusing sufficient, some twenty years prior to this farce, I went to an additional firm in which the technology lead determined that our arranging reasoning (it was a Bubble Sort) required to be recoded in assembler as opposed to being changed by Quick Sort due to the fact that - - Algorithms do not boost performance. The only means to boost performance was to revise the very same reasoning in assembler.

In both instances, I left quickly after the determines boiled down.

0
2019-12-01 23:43:06
Source

Almost neglected this set:

Quote from a supervisor:

Do not deal with or record any kind of pests of concerns you locate in your very own code. The consumer will certainly pay us to recognize and also repair them over the next couple of years.

This had not been for customer software program, yet personalized for a solitary huge company. Obviously, the consumer did spend for years after that. May appear unimportant, yet attempting to overlook pests is tougher than locating them.

0
2019-05-30 09:44:55
Source

(C+npls)

All return values needed to be HRESULTS (the typical ones - not customer specified hresults)

This was simply a couple of years earlier. The elderly individuals were still so obsessed with COM and also they never ever read or found out of various other ideal techniques. It was an extremely shut setting.

The very same area additionally did not permit making use of STL.

I left quickly after I figured out that details.

0
2019-05-21 18:38:10
Source

I benefited a brief time in Japan. I was doing intricate mathematical coding. The firm coding criterion was to have definitely no remarks. It was hard as I would certainly have suched as to add some remarks to clarify the facility estimations and also not neglect myself after couple of weeks. Pity the next individual that follows me to recognize what the code was doing.

It was the very first time I ever before saw that coding remarks were banned.

0
2019-05-21 02:09:17
Source

At a previous work, the C# criterion was to contend the very least 2 rooms in between type name and also variable name in affirmations, the method name have to begin on the next line from the accessibility modifiers and also return type, a room has to take place prior to any kind of open - spelling (parenthesis or brace), all variable affirmations at the start of the method, affirmations different from assignment and also the impression was 3 rooms. Instance:

private static int
ThisIsTheMethod (int  code, string  message)
{
int  i;
int  j;
int  k;

for (i = 0; i < message.Length; i++)
{
if (message [i] == '!') return -1;
}

j = SomeMethod (code);
k = OtherMethod (j);

return k;
}


While hideous, it was practical with the exemption that Visual Studio actually didn't desire points in this way and also it was extra an added action after coding "generally" to reformat it as this.

0
2019-05-21 01:54:29
Source

Worst typical I've ever before needed to encounter:

StyleCop for C#

Take every meaningless criterion ever before and also place it right into a device that goes for compile time as opposed to in the IDE at layout time.

//this is not a legal comment.
//  nor is this


// have to be adhered to by a solitary room, if you are debugging, make use of//// to comment code. Feature has to additionally have 'three-way lower' remarks and also they have to read "Gets or Sets xxxxx" full with a duration at the end and also effectively exploited.

Ugh. Possibly there is a factor with extensively released APIs yet my major beef is they undoubtedly can have constructed it as a plugin a la R #.

0
2019-05-20 22:53:31
Source

Our method names needed to remain in the layout 'Get/Set/Add/ Delete'+name of the target object+names of all the parameters.

GetUserById(userId);
InsertUser(user);
DeleteUser(user);


Fair sufficient - yet the regulation really rigorous. Facility object kinds were not permitted to be shortened, and also procedures constantly needed to detail every demand parameter, despite just how ludicrous:

GetCustomerOrderDeliveryDetailsByCustomerIdAndDeliveryDateAndOrderStatus(...


After including the complete variable names (which weren't permitted to be reduced, either) you can visualize how much time some straightforward method telephone calls were. Word wrappingly long.

0
2019-05-20 22:50:54
Source

I worked years ago where all our code needed to be left - straightened - no indenting. The individual that thought of that plan did not like needing to scroll to and fro flat when watching lengthy lines of code, relating it playing ping - pong with his eyes.

0
2019-05-19 09:55:54
Source

Not actually a coding criterion, yet we had a documents in resource control called 'changelog.txt'

Every time you made a checkin, you needed to by hand add an access to this documents. This access was the subversion alteration number and also your checkin comment.

When the new CTO began and also a person informed him this, he without delay made an executive choice and also claimed, "We're not mosting likely to do this any longer" and also removed the documents. This had actually been taking place for several years.

0
2019-05-12 09:16:48
Source

I did code testimonials on a task led by a C+npls first timer that determined that all class participant features need to be prefixed with the class name and also presence:

class MyClass
{
public:
void MyClass_Public_setValue(int value);
}

0
2019-05-12 07:32:55
Source

I'm compelled to have XML documents for all courses and also class participants. Consisting of exclusive. I'm encuraged to make use of default ghostdoc remarks.

public class User
{
/// <summary>
/// the _userID
/// </summary>
private int _userID;
}

0
2019-05-12 07:24:16
Source

Being compelled to add a documents summary in each documents (it's a C# task).

// --------------------------------------------------------------------------------------------------------------------
// <summary>
//   The user.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

0
2019-05-12 07:02:34
Source

My fave is the "No magic numbers" regulation used cluelessly. As an example, I as soon as saw a comment in a code testimonial mentioning after that the "No magic numbers" regulation had actually been gone against by this line of code:

if (fscanf(file, "%s %hd",name, nbrObject ) != 2 )


I presume the customer desired a constant as opposed to 2, such as #define TWO 2

0
2019-05-11 18:08:34
Source

Not being permitted to make use of the STL or various other typical C+npls collections due to the fact that the CTO thought 'we' can do it far better and also much faster. Also standard constructs like checklists and also the string class.

0
2019-05-11 17:59:27
Source

This was a LONG time ago - - 1976 to be specific. My employer had actually never ever come across Edsger Dijkstra or read a concern of CACM, yet he had actually listened to a report from someplace that "GOTO misbehaves", so we were not permitted to make use of GOTO in our COBOL programs. This was prior to COBOL included the "end if", so at the time it had just 2 - and also - a - fifty percent of the 3 timeless control frameworks (series, if/ after that/ else, execute (i.e. do while) ). He reluctantly permitted GOTO in our Basic programs, and also branch guidelines in our Assembler language programs.

Sorry that this is a type of "you needed to exist" tale. Regarding I recognize, every language designed given that 1976 has ample control frameworks to make sure that you never ever require to make use of GOTO. Yet the factor is, the one in charge never ever recognized WHY GOTO was taken into consideration unsafe, or which language was the childish problem and also which was the deadly condition.

0
2019-05-11 17:09:03
Source

Insisting that all dental braces be adhered to by comment wherefore the support ends:

e.g:

for (int i = 0; i < 10; i++)
{
if (foo > bar)
{
printf("Foo greater than bar");
} // End If (foo > bar)

while (baz)
{
farb();
} // End while (baz)
} // End For

0
2019-05-11 16:59:08
Source

At my last work, "criteria" would certainly be a really solid term wherefore I was offered by the individual that employed me. Setting internet sites in ColdFusion and also SQL, I was offered coding needs like:

• Don't make use of consists of. I such as one large web page
• Always different words in variable and also column names with emphasizes (other than isactive, firstname, etc)
• Never make use of acronyms - - constantly draw up firstname (he regularly created fname etc)
• Don't make use of complex names (like amount_charged and also charge_amount, which gauged differnt yet relevant points)
• Don't make use of DIVs, and also make use of marginal CSS - - usage nested tables rather (I located some 6 layers deep, as soon as).
• Do not cache any kind of questions. Ever before.
• Mosting likely to make use of a variable on greater than one web page? Application extent.
• Each web page is its very own try/catch block. We do not need/want an international mistake trainer.

I began transforming these as quickly as he gave up.

0
2019-05-11 16:21:55
Source

I've been collaborating with an internet system for some time where all parameters passed needed to be called P1, P2, P3 etc No opportunity in heck to recognize what they where for without considerable documents.

Additionally - although not purely a coding typical - in the very same system, each and every single documents was to be called xyz0001.ext, xyz0002.ext, xyz0003.ext, etc - where xyz was the code for the application by itself.

0
2019-05-10 10:39:43
Source

All result in a PHP manuscript have to be resembled line by line.

<?php
echo "<div id=\"foo\">";
echo "<h1>" . $title . "</h1>"; echo paragraphs($body); // just an example
echo "</div>";
?>


(Disclaimer : I really did not need to follow it, yet a group I collaborated with did.)

0
2019-05-10 10:38:41
Source

The worst coding typical I've ever before joined is code bases which had none in all. I would certainly instead adhere to a coding criterion I entirely differ with than operate in code bases where there is none in all. It makes it that a lot tougher to find out repairs of the code base.

0
2019-05-10 10:37:52
Source

This even more an instance of just how not having coding standards can injure.

A service provider operating at a huge financial institution urged that adhering to the criteria were the most effective ever before. The application was created in dBase/Clipper which he was the single programmer for and also certainly he thought of the criterion.

• Every little thing remains in upper instance. I suggest every little thing, consisting of the uncommon remarks he made.
• No indentation.
• Variable identifying was something along the lines of APRGNAME. A = extent of variable, eg P for public, PRG = first 3 personalities of the resource documents that developed the variable, NAME = variable name in the continuing to be 6 personalities that dBase/Clipper permitted.
• The first 4 and also last 4 lines of the resource code were 80 * long. Why? So he can listen to the dot matrix printer beginning and also ending up the printing of a documents. Memory is the whole program was published using the data processor weekly, 20,000 web pages.
• I'm certain there were much more that I've taken care of to unload from my mind.

I was a brand-new self - educated designer at that phase yet recognized sufficient not to pay attention to the crazy researcher and also get the heck out of there prior to I asked to take control of the task.

And also of course we informed monitoring just how negative these techniques were yet constantly obtained the common "were paying this service provider leading buck he have to recognize what he's speaking about".

0
2019-05-10 10:29:04
Source

At one firm we needed to write technological documenation that clarified just how we will certainly write a capability. It quickly ventured out - dated given that you wont think of every little thing when youre shows in UML.

0
2019-05-10 10:25:59
Source

" Do not make use of C+npls comment design for C code".

While this might still have a tiny value if there is threat of requiring to port your program to an out-of-date compiler, it's primarily simply a problem. My largest argument is that it makes it actually awkward /* to obstruct comment out a huge area throughout development or device screening. */

0
2019-05-10 07:04:57
Source

No extra than one line of code admitted Main ()

A teacher at my college that I was privileged sufficient not to have actually urged that her junior C# pupils not be permitted to place greater than one line of code in their console applications' access factor.

This makes a practical quantity of feeling when creating a specialist application, yet when the program's just intent is to take couple of standard inputs and also generate a solitary result (i.e. MultiplyTwoNumbers.exe), such a need is extra discomfort than excellent.

In addition to the "one line of code in major" the teacher additionally urged that every line of code have a detailed comment and also every class participant have a verbosely detailed name. Factors shed if the teacher really did not really feel that these needs had actually been fulfilled "appropriately".

The pupils compelled to adhere to these regulations were (virtually) all newbies to shows and also hence I can see the value of applying performs like excellent - identifying and also splitting up of problems. Regardless of that, as the.NET Tutor at my college I was frequently aiding her pupils fulfill these ordinary and also ridiculous needs long after they had actually obtained their code functioning .

In my point of view, when enlightening a person that is all new to a shows language the first problem need to be just how to create code, not just how to create criteria - based code.

0
2019-05-10 06:12:07
Source

Nearly any kind of type of variable identifying convention that states the variable type, mutability, extent/ storage space class, and/or their reference. Primarily, any kind of construct inherent to the language. This is no more essential in the 21st century with modern-day IDEs (and also in my point of view just initially addressed inadequate code format/ techniques to start with). This consists of hungarian symbols and also its versions :

• bigBlobStr - A string.
• bigBlobStrCurLocPtr - A reminder to the "existing area" in claimed string.
• someIntArray - Array of integers

or points like :

• sg_prefPoolSz - Static international variable

and also certainly one the limit eye sore in OOP, m _ for all participants. If you can not make certain/ track which variables are neighborhood, participants, globals, fixed, or final/const, you could be creating vague, inadequately factored, pastas code.

This is wholey various than defining a prefix/suffix convention for points like minutes, max, avg, dimension, matter, index, and so on, which is great.

0
2019-05-10 05:59:03
Source
#define AND  &&
#define OR   ||
#define EQ   ==


' nuff claimed.

0
2019-05-09 10:31:23
Source

Had a teacher as soon as that required we contend the very least one comment for each and every line of code.

//Set x to 3
var x = 3;

//if x is greater than 2
if(x>2){

//Print x
Print(x);
}


It was rather ludicrous.

0
2019-05-09 10:27:32
Source

Enforced XML talk about all non - exclusive approaches, constants, enums, and also buildings.

It brought about some rather chaotic code, specifically given that completion outcome was individuals either simply striking/// to create a vacant comment stub for every little thing or mounting GhostDoc and also having it add vehicle - created remarks:

/// <summary>
/// Validations the handler.
/// </summary>
/// <param name="propertyName">The property name.</param>
public void ValidationHandler(string propertyName)
{
// whatever
}


[Edit ] The factor I state this as a ludicrous criterion isn't due to the fact that I assume method remarks are foolish yet due to the fact that the top quality of these remarks had not been applied at all and also caused simply developing whole lots and also great deals of mess in the code documents. There are far better means of developing purposeful code docs than blind "have to have a comment" construct need.

0
2019-05-09 10:08:24
Source

I was asked by the software program leader of a firm to do" straightforward, re n dundant code ". It was restricted, as an example, to add a new parameter to a present function. You rather needed to replicate the function, leaving the initial unblemished to avoid regressions. No official testing certainly (wild-goose chase).

We were additionally restricted from making use of combine software program ; each documents can just be changed by one designer at once. Alteration control software program was sci-fi, certainly.

The happiest day of my life was when he was discharged (take into consideration that it is really, really hard to fire a person in Italy).

0
2019-05-09 10:06:24
Source

All communication with the data source needs to be done via stored procedures. It could make good sense if we're staying in 1997 and also not 2010.

I simply understood that this in fact covers all the standards of the initial inquiry:

• Greatly lowered your performance? CHECK. Please - simply make use of an ORM.
• Were initially consisted of forever factors yet were maintained long after the initial problem came to be unnecessary? CHECK. The supervisor was a programmer for a data source web server 1000 years earlier and also place this coding criterion in.
• Remained in a checklist as long that it was difficult to bear in mind them all? CHECK. This consisted of 'as much reasoning needs to be saved in the data source as feasible'.
• Made you assume the writer was simply attempting to leave their mark as opposed to motivating excellent coding technique? CHECK. Maintains returning to the supervisor being an ex-spouse - data source web server programmer.
• You had no suggestion why they were consisted of? CHECK.
0
2019-05-09 10:03:40
Source

I as soon as worked with a task in which the task lead mandated that every variable - EVERY variable - be prefixed with "v". So, vCount, vFirstName, vIsWarranty, etc

Why? "Because we're operating in VBScript and also every little thing is a Variant anyhow".

WTF.

0
2019-05-08 08:41:20
Source

Forcing inline remarks for variation control had to do with one of the most meaningless coding typical I overlooked.

//Changed on 2/2/2004 By Ryan Roberts for work item #2323332
Dim Some Horrendous VB
//End Changed


The Oracle DBA that demanded proper use whitespace while 'keeping' a data source with a very competed table that had more than 200 areas and also 40 triggers comes close.

0
2019-05-08 08:32:13
Source

Mandatory incorporation, development of $Log$ details when our SCC was archaic variation of PVCS. We had some documents where the $Log$ details was a lot, a lot longer than the real code in the documents.

0
2019-05-08 08:17:30
Source

In my life as C++ programmer, 2 actually horrible "regulations" were applied :

1. " We can not make use of the STL, due to the fact that VC++ 4.1 does not sustain it (and also we can not switch over to VC++ 6.0 right now)."
2. " Do not make use of QuickSort, due to the fact that it can be O (n ^ 2) in negative instances ; utilize this execution of the HeapSort algorithm I (name of task leader removed) created as a pupil."
0
2019-05-08 08:05:56
Source

The worst was a task (C++) where courses were prefixed with component acronyms.

As an example, if something remained in the MessagePassing component, and also component of the Response device, it could be called MESPAS_RESSomeobject.

Working with that code made me intend to gouge out my eyes.

Not the most awful, yet my existing work calls for a c_ prefixes on courses and also e_ prefixes for enums. Absolutely nothing for structs. yet _t postfix on typedefs. It's rather hideous also.

Oh, and also function header remarks in BOTH.h and.cpp (declaration and also definition) which certainly virtually never ever match.

0
2019-05-08 07:50:27
Source

Being called for to indent all code by 4 rooms ;)

0
2019-05-08 07:33:17
Source

Some of the areas I've collaborated with demanded commenting out extra or deprecated code as opposed to removing it. As opposed to relying on the VCS for background, etc it was shateringly kept in the documents via commented out code.

The large trouble I located with this is that you usually had no suggestion why the code was commented out. Was it due to the fact that some dev was proactively making adjustments and also intended to maintain it around for reference or was it no more required?

0
2019-05-08 07:26:18
Source

I presently operate in a firm where SQL questions are done via something called "Request Class". Just how ludicrous :

In "include/request. class.php"

class RequestClass
{
// ... some code.

public function getUser($where) { global$initrequest

$sql =$initrequest['users']
$sql.=$where;

return execute($sql); } }  . In initrequest.php : $initrequest['users'] = 'SELECT * FROM users WHERE ';

.

And also it was called from the application this way :

$request = new request();$tmpquery = "username = $username AND password =$password";
$request->getUsers($tmpquery);

.

And also they have a comparable layout system based in "blocks", yet after recognizing what I show below, I maintained pushing to trash our entire software program and also revise it in Symfony.

0
2019-05-08 07:23:47
Source

My fave would certainly need to be the data source calling standards we presently are attempting to comply with. All tables made use of for several - several partnerships need to be called making use of the names of the connected tables and also have to be suffixed with "Link". And also certainly, no pluralization of table names.

• OrderLines? Nope. It should be called OrderProductLink
• Friends? Nope. It needs to be PersonPersonLink
0
2019-05-08 06:48:52
Source

Our firm (C#) coding typical asked for considerable use #REGIONs (for those that do not recognize, it notes blocks of resource code that will certainly be collapsted to a solitary line in Visual Studio). Therefore, you constantly opened what appeared to be a perfectly organized class, just to locate heaps and also heaps of waste brushed up under deeply nested carpets of #REGION constructs. You would certainly also have areas around solitary lines, as an example needing to fold up out a layer out a LOG area to locate one solitary declaration of the Logger. Certainly, a lot of approaches included after some area was made, were positioned in the "incorrect" area extent too. The scary. The scary.

Areas are just one of the worst attributes ever before included in Visual Studio ; it urges structuring the surface area as opposed to the real OO framework.

Nowadays, I eliminate #REGIONs on view.

0
2019-05-08 06:29:42
Source

Having what totaled up to C header documents, in a Java task.

User interfaces exist for some excellent factors, yet this typical mandated a user interface (foo.java) for every single solitary class (fooImpl.java) whether it made any kind of feeling or otherwise. Great deals of things to maintain in sync, full disturbance of Eclipse click - right into - method, meaningless active - job.

The construct system applied it, yet I can not visualize what the initial objective was. The good news is we abandoned it for new code when we switched over to a new variation - control and also construct system, yet there's still a great deal of it around.

At the very same time we additionally abandoned the foolish variation - control - details - in - documents - remarks behavior which had actually been required.

0
2019-05-08 06:20:35
Source

Maybe The Huawei Software Company's coding criterion. They desire you to proclaim all participants public :))

0
2019-05-08 06:09:33
Source

I operated in a task were the primary engineer need to write (means also) specific code. Among the most awful instances I located in the code (and also he gladly accepted) was the adhering to.

private string DoSomething( bool verbose )
{
if ( verbose ) { return someString; }
else if ( !verbose ) { return otherString; }
else { return string.Empty; }
}


Also ReSharper informed you this is incorrect!

0
2019-05-08 06:00:28
Source

Writing anything in Fortran (WATFOR, FORTRAN 77) where a non - whitespace personality in column 1 was a comment, and also the compiler really did not advise you if you surpassed column 72, it would certainly simply calmly overlook it.

At the very least I just invested 7 years doing this.

0
2019-05-08 05:53:02
Source

In Visual Basic 6.0, we needed to add mistake handling obstructs to each and every single method. No exemptions. So we did.

After that we needed to clarify why components of the application were slow-moving.

0
2019-05-08 05:49:45
Source

Limited room for variable/object names is possibly my biggest irritability. I've operated in a reasonably modern-day, exclusive language that just permits 10 personalities. This is a holdover from its initial variations.

The net outcome is that you wind up with amusing calling conventions specifying what each personality of your permitted 10 is to stand for. Something like :

• 1 - 3 : application prefix
• 4 - 6 : component prefix
• 7 - 9 : customer specified area
• 10 : a number simply in instance 2 ... or 9 are called the very same point.
0
2019-05-08 05:47:19
Source
• Local variable names are all lowercase without emphasizes

Real instances : paymentmethodtotalshtml, contracttypechangecontexts, customsegmentspectexts, potentialmsceventref

The New York Times weighs in :

" Word rooms need to not be considered provided. Old Greek, the first alphabet to include vowels, can be decoded without word rooms if you appeared it out, and also did without them. [... ] Latin, also, discontinued to divide words by the 2nd century. The loss is confusing, due to the fact that the eye needs to function a lot tougher to read unseparated message. Yet as the paleographer Paul Saenger has actually clarified, the old globe did not need 'to make analysis less complicated and also swifter.'"
0
2019-05-08 05:37:54
Source

Like a great deal of designers (yet not nearly enough), I despise code decor. It exasperates me when I need to make use of a buck indicator (\$) prefix for variable names, or emphasizes for exclusive variables, despite having no getters/setters. If you require to enhance you code to recognize it, after that you require to get the heck out!

0
2019-05-08 04:40:18
Source

This might shake up a couple of plumes, yet criteria that mandate templated block remarks on top of each method constantly bug the black out of me.

1) They are constantly outdated given that they are also much from the code that does the real job to see when you are upgrading points. Negative remarks are even worse than no remarks.

2) They usually simply repeat details that is currently had the resource control device, simply much less exact. As an example : Last Modified by, checklist of alteration date/reasons.

0
2019-05-08 03:50:25
Source

In one work we were compelled to make use of some unusual kind of Hungarian notation in the data source.

I can not bear in mind the information, yet from memory, each area name needed to have :

• No vowels
• All uppercase letters
• A reference to the table
• An information type indication
• An information size
• A nullable indication

For instance, the column holding an individual's given name could be called : PRSNFRSTNMVC30X (Person table, First Name column, Varchar 30 personalities, Not Null)

0
2019-05-08 02:32:03
Source

I locate most of the Mono coding guidelines to be meaningless or counter-productive. As an example :

• 80 column restriction - considering we're all making use of widescreen displays nowadays is simply throwing away the minimal upright room we do not have, and also not taking advantage of the straight room we do have.
• Tabs for rooms - excellent means to make your code resemble a mess when opened up in various editors which have various tab dimensions. (Also, 8 room tabs is simply throwing away the really minimal 80-columns you need to collaborate with anyhow).
• Irregular support placing, wherefore factor? What's incorrect with 1TBS?

There are a variety of various other standards there which are simply "excellent techniques", without thinking.

0
2019-05-08 02:23:56
Source

Hungarian symbols

Sample removed from "Charles Simonyi's explication of the Hungarian notation identifier naming convention" on MSDN.

1  #include “sy.h”
2  extern int *rgwDic;
3  extern int bsyMac;
4  struct SY *PsySz(char sz[])
6      {
7      char *pch;
8      int cch;
9      struct SY *psy, *PsyCreate();
10      int *pbsy;
11      int cwSz;
12      unsigned wHash=0;
13      pch=sz;
14      while (*pch!=0
15        wHash=(wHash11+*pch++;
16      cch=pch-sz;
17      pbsy=&rgbsyHash[(wHash&077777)%cwHash];
18      for (; *pbsy!=0; pbsy = &psy->bsyNext)
19        {
20        char *szSy;
21        szSy= (psy=(struct SY*)&rgwDic[*pbsy])->sz;
22        pch=sz;
23        while (*pch==*szSy++)
24            {
25            if (*pch++==0)
26              return (psy);
27            }
28        }
29      cwSz=0;
30      if (cch>=2)
31        cwSz=(cch-2/sizeof(int)+1;
32      *pbsy=(int *)(psy=PsyCreate(cwSY+cwSz))-rgwDic;
33      Zero((int *)psy,cwSY);
34      bltbyte(sz, psy->sz, cch+1);
35      return(psy);
36      }
.
0
2019-05-07 16:30:18
Source