SlideShare a Scribd company logo
1 of 16
The C Language
 An International Standard


           CIS2450
Professional Aspect of Software
         Engineering
                                  1
ANSI C
• The C language appeared in the early 1970s and
  was originally cryptic, small, and tolerant. For the
  next ten years C evolved in the UNIX
  environment.
• The resultant language was first described in the
  paper “Portability of C Programs and the UNIX
  System,” by S.C. Johnson and Dennis Ritchie in
  1978.
• This style of C was commonly called UNIX C.
                                                     2
ANSI C
• In 1989 the American National Standards Institute
  (ANSI) standardized C as standard X3.159-1989.
• In December of that year the International
  Standards Organization ISO adopted the ANSI C
  standard making minor changes.
• In 1990 ANSI then re-adopted ISO standard C.
• This version of C is known as either ANSI C or
  Standard C.

                                                  3
Implementation Characteristics
• The ANSI standard defines several terms which
  describe the characteristics of an implementation.
  They are useful to describe what is and is not
  acceptable in the language.
• Implementation defined code means that the
  compiler writer chooses what happens and has to
  document it.
   – Example: whether the sign bit is propagated when
     shifting a bit right.

                                                        4
Implementation Characteristics
• Unspecified behavior for something correct
  which the standard does not impose any
  requirements.
   – Example: the order of argument evaluation.
• Undefined behavior is something incorrect which
  the standard does not impose any requirements.
  Anything may happen, from nothing, to a warning
  message, to program termination.
   – Example: what happens when a signed integer
     overflows.
                                                   5
Implementation Characteristics
• A constraint is a restriction or requirement
  which must be obeyed. If you do not then
  your program will become undefined.
  – Example: the operands of the % operator must
    be of integral type or a diagnostic will result.
• An interesting problem with the definition
  of constraints is that compilers only have to
  produce an error message if a program
  violates both syntax and constraints.
                                                       6
Implementation Characteristics
• Semantic rules which are not explicitly
  stated can be broken and because this
  behavior is undefined the compiler does not
  have to issue a warning.
  – Example: the C standard header files have a
    function called malloc, but redefining this
    function is not a constraint so the compiler does
    not have to warn if this happens.

                                                    7
Implementation Characteristics
• Strictly conforming code is one which:
   – uses only specified features
   – doesn't exceed any implementation-defined limit
   – has no output that depends on implementation defined,
     unspecified, or undefined features
• This is not a very interesting class because there
  are so few programs which meet the criteria.



                                                             8
Implementation Characteristics
• Conforming programs can depend on non-
  portable features.
• A conforming program is considered with
  respect to a specific implementation and
  may be non-conforming using a different
  compiler. It can have extensions, but not
  ones which alter the behavior of a strictly
  conforming program.
                                                9
ANSI Changes to (older) C
• A variety of minimum sizes were defined
  by the standard including:
  –   31 parameters in a function definition
  –   31 arguments in a function call
  –   509 characters in a source line
  –   32 levels of nested parentheses in an expression
  –   long ints are at least 32 bits

                                                     10
Differences between ANSI and
              K&R
• Prototype change
  – parameters must be written in the function
    declaration, not just the definition.
• Keyword changes
  – several new keywords were added including
    enum, const, volatile, signed, and void.



                                                 11
Differences between ANSI and
             K&R
• Quiet changes
  – which are mostly minor changes which cause code to
    still compile but perhaps operate in a different manner.
• Everything else
  – these changes will have almost no effect and will
    almost never be encountered in practice, e.g. trigraphs
    can be used to represent a single character by using
    three characters, so ??< represents {


                                                              12
New Features of C99
• Coding
  – end-of-line (//) comments like C++
  – Mix declarations and code
  – Remove implicit function declaration
• Data types
  – long long int (minimum 64bit Integer)
  – Variable length arrays
  – Flexible array members of structures
• Library
  – snprintf family of functions in stdio.h
                                              13
Why Do We Care about Older C?
• For new development, we don’t, but…
• Huge installed code base is “old”
   – Many jobs involve maintenance of legacy code
   – Avoid misunderstanding legacy code
      • Based on your new-C habits
   – Avoid introducing bugs into legacy code
      • Keep to legacy coding style for consistency
• Choices: retain older C compiler or try to upgrade
  to new compiler standard (exposes “code rot”)
                                                      14
What is “code rot”?
• Aka “software rot” “bit rot”
• When program hasn’t been changed,
  yet stops working/compiling
  – Earlier assumptions no longer valid (e.g.,
    famous Y2K bug → 2 bytes no longer enough)
  – Compiler, libraries, or operating system
    “upgraded,” features discontinued or
    incompatible
                                             15
Holding Code Rot at Bay
• Recognize assumptions that won’t stand test of
  time
   – “Users will never need more than 32767 records, so 16-
     bit index is fine!” (+1 looks <0) → Comair fiasco
• Write strictly-conforming software, not relying on
  extensions or “tricks”
   – E.g., intentionally accessing outside array bounds
• Recompile when language spec revised, system
  upgraded, etc.
   – May discover small problems, easily fixed
   – Or BIG problems needing major reexamination
                                                          16

More Related Content

What's hot (20)

Interpreters & Debuggers
Interpreters  &  DebuggersInterpreters  &  Debuggers
Interpreters & Debuggers
 
COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis: COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis:
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to Compilers
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Compiler design
Compiler designCompiler design
Compiler design
 
Language processor
Language processorLanguage processor
Language processor
 
Introduction to Compiler
Introduction to CompilerIntroduction to Compiler
Introduction to Compiler
 
basics of compiler design
basics of compiler designbasics of compiler design
basics of compiler design
 
Compiler design tutorial
Compiler design tutorialCompiler design tutorial
Compiler design tutorial
 
How a Compiler Works ?
How a Compiler Works ?How a Compiler Works ?
How a Compiler Works ?
 
Advanced C - Part 1
Advanced C - Part 1 Advanced C - Part 1
Advanced C - Part 1
 
An overview of computers and programming languages
An overview of computers and programming languages An overview of computers and programming languages
An overview of computers and programming languages
 
Programming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwaresProgramming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwares
 
Principles Of Programing Languages
Principles Of Programing LanguagesPrinciples Of Programing Languages
Principles Of Programing Languages
 
Cd unit i
Cd unit iCd unit i
Cd unit i
 
Compiler design tutorial
Compiler design tutorialCompiler design tutorial
Compiler design tutorial
 
JIT Compiler
JIT CompilerJIT Compiler
JIT Compiler
 

Viewers also liked

Singleton is not_the_only_pattern
Singleton is not_the_only_patternSingleton is not_the_only_pattern
Singleton is not_the_only_patternSeb Rose
 
OnSpotAward_TDMS_team
OnSpotAward_TDMS_teamOnSpotAward_TDMS_team
OnSpotAward_TDMS_teamAbhinav Vatsa
 
Intervensi biology Form 5 chapter 2
Intervensi biology Form 5 chapter 2Intervensi biology Form 5 chapter 2
Intervensi biology Form 5 chapter 2Nirmala Josephine
 
01 iec t1_s1_oo_ps_session_01
01 iec t1_s1_oo_ps_session_0101 iec t1_s1_oo_ps_session_01
01 iec t1_s1_oo_ps_session_01Niit Care
 
Escape sequence in c part 1
Escape sequence in c   part 1Escape sequence in c   part 1
Escape sequence in c part 1Innovative
 
CCNA Interview Questions and Answer ppt - JavaTpoint
CCNA Interview Questions and Answer ppt - JavaTpointCCNA Interview Questions and Answer ppt - JavaTpoint
CCNA Interview Questions and Answer ppt - JavaTpointJavaTpoint.Com
 
BIOLOGY FORM 4 CHAPTER 8 - DYNAMIC ECOSYSTEM PART 5
BIOLOGY FORM 4 CHAPTER 8 - DYNAMIC ECOSYSTEM PART 5BIOLOGY FORM 4 CHAPTER 8 - DYNAMIC ECOSYSTEM PART 5
BIOLOGY FORM 4 CHAPTER 8 - DYNAMIC ECOSYSTEM PART 5Nirmala Josephine
 
C the basic concepts
C the basic conceptsC the basic concepts
C the basic conceptsAbhinav Vatsa
 
Coordination & Response Part 1 - The Nervous System
Coordination & Response Part 1 - The Nervous SystemCoordination & Response Part 1 - The Nervous System
Coordination & Response Part 1 - The Nervous SystemNirmala Josephine
 
Wireless technology from 0G to 7.5G
Wireless technology from 0G to 7.5GWireless technology from 0G to 7.5G
Wireless technology from 0G to 7.5GShashikanth M
 
C++ idioms by example (Nov 2008)
C++ idioms by example (Nov 2008)C++ idioms by example (Nov 2008)
C++ idioms by example (Nov 2008)Olve Maudal
 
Solid C++ by Example
Solid C++ by ExampleSolid C++ by Example
Solid C++ by ExampleOlve Maudal
 
Overview of c language
Overview of c languageOverview of c language
Overview of c languageshalini392
 

Viewers also liked (20)

Singleton is not_the_only_pattern
Singleton is not_the_only_patternSingleton is not_the_only_pattern
Singleton is not_the_only_pattern
 
C Standards: main()
C Standards: main()C Standards: main()
C Standards: main()
 
OnSpotAward_TDMS_team
OnSpotAward_TDMS_teamOnSpotAward_TDMS_team
OnSpotAward_TDMS_team
 
7g
7g7g
7g
 
Intervensi biology Form 5 chapter 2
Intervensi biology Form 5 chapter 2Intervensi biology Form 5 chapter 2
Intervensi biology Form 5 chapter 2
 
C programming tutorial for beginners
C programming tutorial for beginnersC programming tutorial for beginners
C programming tutorial for beginners
 
01 iec t1_s1_oo_ps_session_01
01 iec t1_s1_oo_ps_session_0101 iec t1_s1_oo_ps_session_01
01 iec t1_s1_oo_ps_session_01
 
Escape sequence in c part 1
Escape sequence in c   part 1Escape sequence in c   part 1
Escape sequence in c part 1
 
C tutorial
C tutorialC tutorial
C tutorial
 
Li fi
Li fiLi fi
Li fi
 
SAP BI 7 security concepts
SAP BI 7 security conceptsSAP BI 7 security concepts
SAP BI 7 security concepts
 
CCNA Interview Questions and Answer ppt - JavaTpoint
CCNA Interview Questions and Answer ppt - JavaTpointCCNA Interview Questions and Answer ppt - JavaTpoint
CCNA Interview Questions and Answer ppt - JavaTpoint
 
BIOLOGY FORM 4 CHAPTER 8 - DYNAMIC ECOSYSTEM PART 5
BIOLOGY FORM 4 CHAPTER 8 - DYNAMIC ECOSYSTEM PART 5BIOLOGY FORM 4 CHAPTER 8 - DYNAMIC ECOSYSTEM PART 5
BIOLOGY FORM 4 CHAPTER 8 - DYNAMIC ECOSYSTEM PART 5
 
C the basic concepts
C the basic conceptsC the basic concepts
C the basic concepts
 
Coordination & Response Part 1 - The Nervous System
Coordination & Response Part 1 - The Nervous SystemCoordination & Response Part 1 - The Nervous System
Coordination & Response Part 1 - The Nervous System
 
Wireless technology from 0G to 7.5G
Wireless technology from 0G to 7.5GWireless technology from 0G to 7.5G
Wireless technology from 0G to 7.5G
 
C++11
C++11C++11
C++11
 
C++ idioms by example (Nov 2008)
C++ idioms by example (Nov 2008)C++ idioms by example (Nov 2008)
C++ idioms by example (Nov 2008)
 
Solid C++ by Example
Solid C++ by ExampleSolid C++ by Example
Solid C++ by Example
 
Overview of c language
Overview of c languageOverview of c language
Overview of c language
 

Similar to The C Language - An International Standard

Chapter 1: Introduction
Chapter 1: IntroductionChapter 1: Introduction
Chapter 1: IntroductionEric Chou
 
C STANDARDS (C17).pptx
C STANDARDS (C17).pptxC STANDARDS (C17).pptx
C STANDARDS (C17).pptxSKUP1
 
C STANDARDS (C17) (1).pptx
C STANDARDS (C17) (1).pptxC STANDARDS (C17) (1).pptx
C STANDARDS (C17) (1).pptxSKUP ACADEMY
 
C STANDARDS (C17) (1).pptx
C STANDARDS (C17) (1).pptxC STANDARDS (C17) (1).pptx
C STANDARDS (C17) (1).pptxSKUP ACADEMY
 
C STANDARDS (C17).pptx
C STANDARDS (C17).pptxC STANDARDS (C17).pptx
C STANDARDS (C17).pptxLECO9
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programmingMalikaJoya
 
(2) cpp imperative programming
(2) cpp imperative programming(2) cpp imperative programming
(2) cpp imperative programmingNico Ludwig
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET Dmytro Mindra
 
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 pptANISHYAPIT
 
INTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c languageINTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c languageGOKULKANNANMMECLECTC
 

Similar to The C Language - An International Standard (20)

C session 1.pptx
C session 1.pptxC session 1.pptx
C session 1.pptx
 
Unit ii
Unit   iiUnit   ii
Unit ii
 
Chapter 1: Introduction
Chapter 1: IntroductionChapter 1: Introduction
Chapter 1: Introduction
 
C language unit-1
C language unit-1C language unit-1
C language unit-1
 
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDYC LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
 
C languaGE UNIT-1
C languaGE UNIT-1C languaGE UNIT-1
C languaGE UNIT-1
 
C som-programmeringssprog-bt
C som-programmeringssprog-btC som-programmeringssprog-bt
C som-programmeringssprog-bt
 
C programming
C programmingC programming
C programming
 
C STANDARDS (C17).pptx
C STANDARDS (C17).pptxC STANDARDS (C17).pptx
C STANDARDS (C17).pptx
 
C STANDARDS (C17) (1).pptx
C STANDARDS (C17) (1).pptxC STANDARDS (C17) (1).pptx
C STANDARDS (C17) (1).pptx
 
C STANDARDS (C17) (1).pptx
C STANDARDS (C17) (1).pptxC STANDARDS (C17) (1).pptx
C STANDARDS (C17) (1).pptx
 
C STANDARDS (C17).pptx
C STANDARDS (C17).pptxC STANDARDS (C17).pptx
C STANDARDS (C17).pptx
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
(2) cpp imperative programming
(2) cpp imperative programming(2) cpp imperative programming
(2) cpp imperative programming
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
Ch1 Introducing C
Ch1 Introducing CCh1 Introducing C
Ch1 Introducing C
 
C_Programming_Notes_ICE
C_Programming_Notes_ICEC_Programming_Notes_ICE
C_Programming_Notes_ICE
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
 
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
 
INTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c languageINTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c language
 

Recently uploaded

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 

Recently uploaded (20)

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 

The C Language - An International Standard

  • 1. The C Language An International Standard CIS2450 Professional Aspect of Software Engineering 1
  • 2. ANSI C • The C language appeared in the early 1970s and was originally cryptic, small, and tolerant. For the next ten years C evolved in the UNIX environment. • The resultant language was first described in the paper “Portability of C Programs and the UNIX System,” by S.C. Johnson and Dennis Ritchie in 1978. • This style of C was commonly called UNIX C. 2
  • 3. ANSI C • In 1989 the American National Standards Institute (ANSI) standardized C as standard X3.159-1989. • In December of that year the International Standards Organization ISO adopted the ANSI C standard making minor changes. • In 1990 ANSI then re-adopted ISO standard C. • This version of C is known as either ANSI C or Standard C. 3
  • 4. Implementation Characteristics • The ANSI standard defines several terms which describe the characteristics of an implementation. They are useful to describe what is and is not acceptable in the language. • Implementation defined code means that the compiler writer chooses what happens and has to document it. – Example: whether the sign bit is propagated when shifting a bit right. 4
  • 5. Implementation Characteristics • Unspecified behavior for something correct which the standard does not impose any requirements. – Example: the order of argument evaluation. • Undefined behavior is something incorrect which the standard does not impose any requirements. Anything may happen, from nothing, to a warning message, to program termination. – Example: what happens when a signed integer overflows. 5
  • 6. Implementation Characteristics • A constraint is a restriction or requirement which must be obeyed. If you do not then your program will become undefined. – Example: the operands of the % operator must be of integral type or a diagnostic will result. • An interesting problem with the definition of constraints is that compilers only have to produce an error message if a program violates both syntax and constraints. 6
  • 7. Implementation Characteristics • Semantic rules which are not explicitly stated can be broken and because this behavior is undefined the compiler does not have to issue a warning. – Example: the C standard header files have a function called malloc, but redefining this function is not a constraint so the compiler does not have to warn if this happens. 7
  • 8. Implementation Characteristics • Strictly conforming code is one which: – uses only specified features – doesn't exceed any implementation-defined limit – has no output that depends on implementation defined, unspecified, or undefined features • This is not a very interesting class because there are so few programs which meet the criteria. 8
  • 9. Implementation Characteristics • Conforming programs can depend on non- portable features. • A conforming program is considered with respect to a specific implementation and may be non-conforming using a different compiler. It can have extensions, but not ones which alter the behavior of a strictly conforming program. 9
  • 10. ANSI Changes to (older) C • A variety of minimum sizes were defined by the standard including: – 31 parameters in a function definition – 31 arguments in a function call – 509 characters in a source line – 32 levels of nested parentheses in an expression – long ints are at least 32 bits 10
  • 11. Differences between ANSI and K&R • Prototype change – parameters must be written in the function declaration, not just the definition. • Keyword changes – several new keywords were added including enum, const, volatile, signed, and void. 11
  • 12. Differences between ANSI and K&R • Quiet changes – which are mostly minor changes which cause code to still compile but perhaps operate in a different manner. • Everything else – these changes will have almost no effect and will almost never be encountered in practice, e.g. trigraphs can be used to represent a single character by using three characters, so ??< represents { 12
  • 13. New Features of C99 • Coding – end-of-line (//) comments like C++ – Mix declarations and code – Remove implicit function declaration • Data types – long long int (minimum 64bit Integer) – Variable length arrays – Flexible array members of structures • Library – snprintf family of functions in stdio.h 13
  • 14. Why Do We Care about Older C? • For new development, we don’t, but… • Huge installed code base is “old” – Many jobs involve maintenance of legacy code – Avoid misunderstanding legacy code • Based on your new-C habits – Avoid introducing bugs into legacy code • Keep to legacy coding style for consistency • Choices: retain older C compiler or try to upgrade to new compiler standard (exposes “code rot”) 14
  • 15. What is “code rot”? • Aka “software rot” “bit rot” • When program hasn’t been changed, yet stops working/compiling – Earlier assumptions no longer valid (e.g., famous Y2K bug → 2 bytes no longer enough) – Compiler, libraries, or operating system “upgraded,” features discontinued or incompatible 15
  • 16. Holding Code Rot at Bay • Recognize assumptions that won’t stand test of time – “Users will never need more than 32767 records, so 16- bit index is fine!” (+1 looks <0) → Comair fiasco • Write strictly-conforming software, not relying on extensions or “tricks” – E.g., intentionally accessing outside array bounds • Recompile when language spec revised, system upgraded, etc. – May discover small problems, easily fixed – Or BIG problems needing major reexamination 16