Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcba7e6d

Browse files
committed
Format code snippets
1 parent25a3f0d commitcba7e6d

File tree

1 file changed

+34
-39
lines changed

1 file changed

+34
-39
lines changed

‎README.md‎

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -221,16 +221,15 @@ Much of the skill in writing unmaintainable code is the art of camouflage, hidin
221221
Include sections of code that are commented out but at first glance do not appear to be.
222222

223223
```js
224-
for(j=0; j<array_len; j+=8)
225-
{
226-
total+= array[j+0 ];
227-
total+= array[j+1 ];
228-
total+= array[j+2 ];/* Main body of
229-
total += array[j+3 ]; * loop is unrolled
230-
total += array[j+4 ]; * for greater speed.
231-
total += array[j+5 ];*/
232-
total+= array[j+6 ];
233-
total+= array[j+7 ];
224+
for (j=0; j<array_len; j+=8) {
225+
total+= array[j+0];
226+
total+= array[j+1];
227+
total+= array[j+2];/* Main body of
228+
total += array[j+3]; * loop is unrolled
229+
total += array[j+4]; * for greater speed.
230+
total += array[j+5];*/
231+
total+= array[j+6];
232+
total+= array[j+7];
234233
}
235234
```
236235

@@ -242,14 +241,14 @@ Struct/union and typedef struct/union are different name spaces in C (not in C++
242241

243242
```c
244243
typedefstruct {
245-
char* pTr;
246-
size_t lEn;
244+
char* pTr;
245+
size_t lEn;
247246
} snafu;
248247

249248
struct snafu {
250-
unsigned cNt
251-
char* pTr;
252-
size_t lEn;
249+
unsigned cNt
250+
char* pTr;
251+
size_t lEn;
253252
} A;
254253
```
255254

@@ -441,10 +440,9 @@ Discourage any attempt to use external maintenance contractors by peppering your
441440
This stuff is too clever for the dullard at Software Services Inc., who would
442441
probably use 50 times as memory & time using the dumb routines in <math.h>.
443442
*/
444-
class clever_SSInc
445-
{
443+
class clever_SSInc {
446444
.. .
447-
}
445+
}
448446
```
449447

450448
If possible, put insulting stuff in syntactically significant parts of the code, as well as just the comments so that management will probably break the code if they try to sanitise it before sending it out for maintenance.
@@ -515,10 +513,9 @@ Go wild with encapsulation and oo. For example:
515513

516514
```java
517515
myPanel.add( getMyButton() );
518-
privateJButton getMyButton()
519-
{
516+
privateJButton getMyButton() {
520517
return myButton;
521-
}
518+
}
522519
```
523520

524521
That one probably did not even seem funny. Don't worry. It will some day.
@@ -653,18 +650,17 @@ Always look for the most obscure way to do common tasks. For example, instead of
653650

654651
```c
655652
char *p;
656-
switch (n)
657-
{
658-
case 1:
659-
p = "one";
660-
if (0)
661-
case 2:
662-
p = "two";
663-
if (0)
664-
case 3:
665-
p = "three";
666-
printf("%s", p);
667-
break;
653+
switch (n) {
654+
case 1:
655+
p = "one";
656+
if (0)
657+
case 2:
658+
p = "two";
659+
if (0)
660+
case 3:
661+
p = "three";
662+
printf("%s", p);
663+
break;
668664
}
669665
```
670666

@@ -707,12 +703,11 @@ d = c;
707703
Smuggle octal literals into a list of decimal numbers like this:
708704

709705
```java
710-
array=newint []
711-
{
712-
111,
713-
120,
714-
013,
715-
121,
706+
array=newint [] {
707+
111,
708+
120,
709+
013,
710+
121,
716711
};
717712
```
718713

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp