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

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
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
hublikarsn
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
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)

👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...
👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...
👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Post office management system project ..pdf
Post office management system project ..pdfPost office management system project ..pdf
Post office management system project ..pdf
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
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
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system 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 ...
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
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
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
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
 

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.