SlideShare a Scribd company logo
1 of 8
C STANDARDS (C17)
C17
• C17 is the informal name for ISO/IEC 9899:2018, the most recent
standard for the C programming language, prepared in 2017 and
published in June 2018.
• It specifies the following:
1. the representation of C programs;
2. the syntax and constraints of the C language;
3. the semantic rules for interpreting C programs;
4. the representation of input data to be processed by C programs;
5. the representation of output data produced by C programs;
6. the restrictions and limits imposed by a conforming implementation of C.
NAMES
• Names are the heart of programming.
• Only a programmer who understands the system as a whole can create
a name that "fits" with the system.
• If the name is appropriate everything fits together naturally,
relationships are clear, meaning is derivable, and reasoning from
common human expectations works as expected.
• Usually every function performs an action, so the name should make
clear what it does.
• Structs are often nouns. By making function names verbs and following
other naming conventions programs can be read more naturally.
• Suffixes are sometimes useful:
• max - to mean the maximum value something can have.
• cnt - the current count of a running count variable.
• key - key value.
• Prefixes are sometimes useful:
• is - to ask a question about something. Whenever someone sees Is they will know
it's a question.
• get - get a value.
• set - set a value.
FORMATTING
• BRACES : 1. A recommended brace placement stratergy:
if (condition) { while (condition) {
... ...
} }
2. Add Comments to Closing Braces.
3. Consider Screen Size Limits.
• PARENS () WITH KEY WORDS AND FUNCTIONS POLICY :
1. Do not put parens next to keywords. Put a space between.
2. Do put parens next to function names.
3. Do not use parens in return statements when it's not necessary.
• A LINE SHOULD NOT EXCEED 78 CHARACTERS.
• IF THEN ELSE FORMATTING : It's up to the programmer. Different
bracing styles will yield slightly different looks. One common approach is:
if (condition) {
} else if (condition) {
} else {
}
• SWITCH FORMATTING
• Falling through a case statement into the next case statement shall be
permitted as long as a comment is included.
• The default case should always be present and trigger an error if it
should not be reached, yet is reached.
DOCUMENTATION
• COMMENTS : Expect your comments to be extracted by a robot and
formed into a man page. Class comments are one part of the story, method
signature comments are another part of the story, method arguments another
part, and method implementation yet another part.
• DOCUMENT DECISIONS: Comments should document decisions. At
every point where you had a choice of what to do place a comment
describing which choice you made and why.
• MAKE GOTCHAS EXPLICIT: Explicitly comment variables changed
out of the normal control flow or other code likely to break during
maintenance. Embedded keywords are used to point out issues and potential
problems.
• COMMENTING FUNCTION DECLARATIONS: Functions headers
should be in the file where they are declared.
LAYERING
• Layering is the primary technique for reducing complexity in a
system.
• A system should be divided into layers. Layers should communicate
between adjacent layers using well defined interfaces.
• When a layer uses a non-adjacent layer then a layering violation has
occurred.
• A layering violation simply means we have dependency between
layers that is not controlled by a well defined interface.
• When one of the layers changes code could break. We don't want code
to break so we want layers to work only with other adjacent layers.

More Related Content

Similar to C STANDARDS (C17) (1).pptx

03 the c language
03 the c language03 the c language
03 the c language
arafatmirza
 
CHAPTER 1 Creating a ProgramOBJECTIVES· Analyze some of the i.docx
CHAPTER 1 Creating a ProgramOBJECTIVES· Analyze some of the i.docxCHAPTER 1 Creating a ProgramOBJECTIVES· Analyze some of the i.docx
CHAPTER 1 Creating a ProgramOBJECTIVES· Analyze some of the i.docx
walterl4
 
Chapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this pptChapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this ppt
ANISHYAPIT
 
Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptxChapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
rajinevitable05
 

Similar to C STANDARDS (C17) (1).pptx (20)

03 the c language
03 the c language03 the c language
03 the c language
 
CHAPTER 1 Creating a ProgramOBJECTIVES· Analyze some of the i.docx
CHAPTER 1 Creating a ProgramOBJECTIVES· Analyze some of the i.docxCHAPTER 1 Creating a ProgramOBJECTIVES· Analyze some of the i.docx
CHAPTER 1 Creating a ProgramOBJECTIVES· Analyze some of the i.docx
 
CSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageCSE 1201: Structured Programming Language
CSE 1201: Structured Programming Language
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
 
Aspect Oriented Programming
Aspect Oriented ProgrammingAspect Oriented Programming
Aspect Oriented Programming
 
No Programmer Is an Island
No Programmer Is an IslandNo Programmer Is an Island
No Programmer Is an Island
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
An Introduction To Software Development - Implementation
An Introduction To Software Development - ImplementationAn Introduction To Software Development - Implementation
An Introduction To Software Development - Implementation
 
Chapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this pptChapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this ppt
 
Component based development | what, why and how
Component based development | what, why and howComponent based development | what, why and how
Component based development | what, why and how
 
Unit-1 (introduction to c language).pptx
Unit-1 (introduction to c language).pptxUnit-1 (introduction to c language).pptx
Unit-1 (introduction to c language).pptx
 
Clean Code - Part 2
Clean Code - Part 2Clean Code - Part 2
Clean Code - Part 2
 
Writing Clean Code (Recommendations by Robert Martin)
Writing Clean Code (Recommendations by Robert Martin)Writing Clean Code (Recommendations by Robert Martin)
Writing Clean Code (Recommendations by Robert Martin)
 
Design p atterns
Design p atternsDesign p atterns
Design p atterns
 
Getting started with CATIA V5 Macros
Getting started with CATIA V5 MacrosGetting started with CATIA V5 Macros
Getting started with CATIA V5 Macros
 
Learning the C Language
Learning the C LanguageLearning the C Language
Learning the C Language
 
NamingConvention
NamingConventionNamingConvention
NamingConvention
 
Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptxChapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
 
Basics of C Prog Lang.pdf
Basics of C Prog Lang.pdfBasics of C Prog Lang.pdf
Basics of C Prog Lang.pdf
 
Code Inspection
Code InspectionCode Inspection
Code Inspection
 

Recently uploaded

1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
pritamlangde
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 

Recently uploaded (20)

1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Memory Interfacing of 8086 with DMA 8257
Memory Interfacing of 8086 with DMA 8257Memory Interfacing of 8086 with DMA 8257
Memory Interfacing of 8086 with DMA 8257
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 

C STANDARDS (C17) (1).pptx

  • 2. C17 • C17 is the informal name for ISO/IEC 9899:2018, the most recent standard for the C programming language, prepared in 2017 and published in June 2018. • It specifies the following: 1. the representation of C programs; 2. the syntax and constraints of the C language; 3. the semantic rules for interpreting C programs; 4. the representation of input data to be processed by C programs; 5. the representation of output data produced by C programs; 6. the restrictions and limits imposed by a conforming implementation of C.
  • 3. NAMES • Names are the heart of programming. • Only a programmer who understands the system as a whole can create a name that "fits" with the system. • If the name is appropriate everything fits together naturally, relationships are clear, meaning is derivable, and reasoning from common human expectations works as expected.
  • 4. • Usually every function performs an action, so the name should make clear what it does. • Structs are often nouns. By making function names verbs and following other naming conventions programs can be read more naturally. • Suffixes are sometimes useful: • max - to mean the maximum value something can have. • cnt - the current count of a running count variable. • key - key value. • Prefixes are sometimes useful: • is - to ask a question about something. Whenever someone sees Is they will know it's a question. • get - get a value. • set - set a value.
  • 5. FORMATTING • BRACES : 1. A recommended brace placement stratergy: if (condition) { while (condition) { ... ... } } 2. Add Comments to Closing Braces. 3. Consider Screen Size Limits. • PARENS () WITH KEY WORDS AND FUNCTIONS POLICY : 1. Do not put parens next to keywords. Put a space between. 2. Do put parens next to function names. 3. Do not use parens in return statements when it's not necessary.
  • 6. • A LINE SHOULD NOT EXCEED 78 CHARACTERS. • IF THEN ELSE FORMATTING : It's up to the programmer. Different bracing styles will yield slightly different looks. One common approach is: if (condition) { } else if (condition) { } else { } • SWITCH FORMATTING • Falling through a case statement into the next case statement shall be permitted as long as a comment is included. • The default case should always be present and trigger an error if it should not be reached, yet is reached.
  • 7. DOCUMENTATION • COMMENTS : Expect your comments to be extracted by a robot and formed into a man page. Class comments are one part of the story, method signature comments are another part of the story, method arguments another part, and method implementation yet another part. • DOCUMENT DECISIONS: Comments should document decisions. At every point where you had a choice of what to do place a comment describing which choice you made and why. • MAKE GOTCHAS EXPLICIT: Explicitly comment variables changed out of the normal control flow or other code likely to break during maintenance. Embedded keywords are used to point out issues and potential problems. • COMMENTING FUNCTION DECLARATIONS: Functions headers should be in the file where they are declared.
  • 8. LAYERING • Layering is the primary technique for reducing complexity in a system. • A system should be divided into layers. Layers should communicate between adjacent layers using well defined interfaces. • When a layer uses a non-adjacent layer then a layering violation has occurred. • A layering violation simply means we have dependency between layers that is not controlled by a well defined interface. • When one of the layers changes code could break. We don't want code to break so we want layers to work only with other adjacent layers.