العربية  

books example of code formatting and beautification

If you do not find what you're looking for, you can use more accurate words.

View more

مثال على تنسيق الكود وتجميله (Info)


المثال التالي يبين بعض هياكل C النموذجية وكيف تنسقهم قوانين أسلوب المسافة البادئة. وبدون أي تنسيق إطلاقا، يبدو كالأسفل:

int foo(int k) { if (k < 1 || k > 2) { printf("out of range"); printf("this function requires a value of 1 or 2"); } else { printf("Switching"); switch (k) { case 1: printf("1"); break; case 2: printf("2"); break; } } }

ينتج برنامج GNU للمسافة البادئة المعطى التالي عندما يُطلب منه ترك مسافة طبقا لقوانين GNU:

int foo (int k) { if (k < 1 || k > 2) { printf ("out of range"); printf ("this function requires a value of 1 or 2"); } else { printf ("Switching"); switch (k) { case 1: printf ("1"); break; case 2: printf ("2"); break; } } }

وينتج المعطى التالي عند التنسيق طبقا لقوانين BSD:

int foo(int k) { if (k < 1 || k > 2) { printf("out of range"); printf("this function requires a value of 1 or 2"); } else { printf("Switching"); switch (k) { case 1: printf("1"); break; case 2: printf("2"); break; } } }

Source: wikipedia.org
 
(5)
Proverbs

Proverbs