MISRA C

MISRA C is a set of software development guidelines for the C programming language developed by The MISRA Consortium. Its aims are to facilitate code safety, security, portability and reliability in the context of embedded systems, specifically those systems programmed in ISO C / C90 / C99.[1]

There is also a set of guidelines for MISRA C++ not covered by this article.

History

  • Draft: 1997[2]
  • First edition: 1998 (rules, required/advisory)
  • Second edition: 2004 (rules, required/advisory)
  • Third edition: 2012 (directives; rules, Decidable/Undecidable)
  • MISRA compliance: 2016, updated 2020
  • MISRA C:2023 (MISRA C Third edition, Second revision)

For the first two editions of MISRA-C (1998 and 2004) all Guidelines were considered as Rules. With the publication of MISRA C:2012 a new category of Guideline was introduced - the Directive whose compliance is more open to interpretation, or relates to process or procedural matters.

Adoption

Although originally specifically targeted at the automotive industry, MISRA C has evolved as a widely accepted model for best practices by leading developers in sectors including automotive, aerospace, telecom, medical devices, defense, railway, and others. For example:

  • The Joint Strike Fighter project C++ Coding Standards[3] are based on MISRA-C:1998.
  • The NASA Jet Propulsion Laboratory C Coding Standards[4] are based on MISRA-C:2004.
  • IEC 81001-5-1:2021 Health software and health IT systems safety, effectiveness and security - Part 5-1: Security - Activities in the product lifecycle cites MISRA C as an example of secure coding best practices.
  • ISO 26262 Functional Safety - Road Vehicles cites MISRA C as being an appropriate sub-set of the C language:
    • ISO 26262-6:2011 Part 6: Product development at the software level[5] cites MISRA-C:2004 and MISRA AC AGC.
    • ISO 26262-6:2018 Part 6: Product development at the software level[6] cites MISRA C:2012.
  • The AUTOSAR General Software Specification (SRS_BSW_00007) likewise cites MISRA C:
    • The AUTOSAR 4.2 General Software Specification[7] requires that If the BSW Module implementation is written in C language, then it shall conform to the MISRA C:2004 Standard.
    • The AUTOSAR 4.3 General Software Specification[8] requires that If the BSW Module implementation is written in C language, then it shall conform to the MISRA C:2012 Standard.

Guideline classification and categorization

When a new software project is started, the latest MISRA standard should be used. Previous standards are still available for use with legacy software projects that need to refer to it.[9]

Classification

Each Guideline is classified[10] as Mandatory (new for MISRA C:2012), Required or Advisory. Furthermore, the MISRA Compliance document permits Advisory guidelines to be Disapplied.

  • Mandatory guidelines shall always be complied with
  • Required guidelines shall be complied with, unless subject to a Deviation
  • Advisory guidelines are considered good practice, but compliance is less formal.

Categorization

The rules can be divided logically into a number of categories:

  • Avoiding possible compiler differences, for example, the size of C's int type may vary but int16_t (standardized in C99) is always 16 bits.
  • Avoiding using functions and constructs that are prone to failure, for example, malloc may fail.
  • Produce maintainable and debuggable code, for example, naming conventions and commenting.
  • Best practice rules.
  • Complexity limits.

Scope

MISRA C:2012 separately classifies each guideline as either Single Translation Unit or System.[10]

Decidability

MISRA C:2012 classifies the rules (but not the directives) as Decidable or Undecidable.

Achieving compliance

MISRA compliance

MISRA published documents to provide additional guidance to understand and achieve MISRA compliance.

  • MISRA Compliance:2016, was released by MISRA in April 2016.[11]
  • MISRA Compliance:2020, revised edition, was released in February 2020.[12]

Compliance

In order for a piece of software to claim to be compliant to the MISRA C Guidelines, all mandatory rules shall be met and all required rules and directives shall either be met or subject to a formal deviation. Advisory rules may be disapplied without a formal deviation, but this should still be recorded in the project documentation.

Note: For compliance purposes, there is no distinction between rules and directives.

Deviations

Many MISRA C rules can be characterized as guidelines because under certain condition software engineers may deviate from rules and still be considered compliant with the standard. Deviations must be documented either in the code or in a file. In addition; proof must be provided that the software engineer has considered the safety of the system and that deviating from the rule will not have a negative impact, requirements for deviations also include:

  • The rule deviated from.
  • Rationale for deviation.[13]

Published documents

MISRA C:1998

The first edition of MISRA C, "Guidelines for the use of the C language in vehicle based software", which was published in 1998 and is officially known as MISRA-C:1998.[14]

MISRA-C:1998 has 127 rules, of which 93 are required and 34 are advisory; the rules are numbered in sequence from 1 to 127.

MISRA C:2004

In 2004, a second edition "Guidelines for the use of the C language in critical systems", or MISRA-C:2004 was produced, with many substantial changes to the guidelines, including a complete renumbering of the rules.

MISRA-C:2004 contains 142 rules, of which 122 are "required" and 20 are "advisory"; they are divided into 21 topical categories, from "Environment" to "Run-time failures".

MISRA C:2012

Main document

In 2013, the third edition, MISRA C:2012, was published. MISRA C:2012 extends support to the C99 version of the C language (while maintaining guidelines for C90), in addition to including a number of improvements that can reduce the cost and complexity of compliance, whilst aiding consistent, safe use of C in critical systems.[15]

MISRA-C:2012 contains 143 rules and 16 "directives" (that is, rules whose compliance is more open to interpretation, or relates to process or procedural matters); each of which is classified as mandatory, required, or advisory. They are separately classified as either Single Translation Unit or System. Additionally, the rules are classified as Decidable or Undecidable.

Amendment 1

In April 2016, MISRA published (as a free download) MISRA C:2012 - Amendment 1: Additional Security Guidelines[16] which added fourteen new security guidelines.

Amendment 2

In February 2020, MISRA published (as a free download) MISRA C:2012 - Amendment 2: Updates for ISO/IEC 9899:2011/18 Core functionality[17] which adds mapping for the undefined, unspecified and implementation defined behaviours within C11/C18.

Supporting documents

MISRA have published the following addenda to support MISRA C:2012:

  • MISRA C:2012 - Addendum 1: Rule Mappings,[18] which contains bi-directional rule mappings between MISRA C:2004 and the new version. It is intended to assist users in migration.
  • MISRA C:2012 - Addendum 2: Coverage of MISRA C:2012 against ISO/IEC TS 17961:2013 "C Secure"[19]
  • MISRA C:2012 - Addendum 3: Coverage of MISRA C:2012 against CERT C[20]

MISRA C:2023

In May 2023 MISRA published MISRA C:2023 (MISRA C Third edition, Second revision) which incorporates Amendments 2 – 4 (AMD2, AMD3, AMD4) and Technical Corrigendum 2 (TC2) and incorporates support for C11 and C17 language features. [21]

Example suite

An exemplar suite (for MISRA-C:2004 and MISRA C:2012) is available from the MISRA GitLab[22] repository (login required). This allows tool-users to evaluate and compare the checking support provided by the various MISRA tools; additionally, it gives tool-implementers some guidance as to the intent of the MISRA Guidelines.

Tools

While there exist many software tools that claim to check code for "MISRA conformance", there is no MISRA certification process.[23]

Most of the guidelines can be checked using tools that perform static code analysis. The remaining guidelines require the use of dynamic code analysis.

Tools that check code for MISRA conformance include:

C/C++ compilers that support MISRA conformance include:

Criticism

Some research results question the effectiveness of MISRA C 2004.

In a paper that compares earlier work on MISRA C:1998 with MISRA C:2004, Les Hatton comes to the conclusion that:[30]

In view of the apparent widening influence of the MISRA C standard, this paper attempts to assess whether important deficiencies in the original standard have been addressed satisfactorily. Unfortunately, they have not and the important real to false positive ratio is not much better in MISRA C 2004 than it was in MISRA C 1998 and it is unacceptably low in both.

He goes on to state:[30]

In its present form, the only people to benefit from the MISRA C 2004 update would appear to be tool vendors and it is to be hoped that steps will be taken both to simplify the wording and to reduce the false positive ratio in future revisions by taking a little more notice of published experimental data and being less tempted to invent rules on the basis that they seem a good idea.

A study at the TU Delft, by Cathal Boogerd and Leon Moonen, empirically assesses the value of MISRA C:2004. It comes to similar results:[31]

From the data obtained, we can make the following key observations. First, there are 9 out of 72 rules for which violations were observed that perform significantly better (α = 0.05) than a random predictor at locating fault-related lines. The true positive rates for these rules range from 24-100%. Second, we observed a negative correlation between MISRA rule violations and observed faults. In addition, 29 out of 72 rules had a zero true positive rate. Taken together with Adams' observation that all modifications have a non-zero probability of introducing a fault, this makes it possible that adherence to the MISRA standard as a whole would have made the software less reliable.

See also

References

  1. ^ "MISRA clarifies safe and secure uses of the C language". www.misra.org.uk. Archived from the original on 2020-08-04. Retrieved 2019-10-09.
  2. ^ In spring 1997 software engineers at the Austin Rover Group (ARG) sent a draft C coding standard to Programming Research Ltd (PRL) for review. The review was performed by PRL's then senior consultant, David Blyth, who proposed replacing the draft with an appreciably stronger set of coding rules. Those rules, with minor changes, formed the basis of the first edition of MISRA C.
  3. ^ "Joint Strike Fighter Air Vehicle C++ Coding Standards" (PDF). Retrieved 2019-07-16.
  4. ^ "JPL Institutional Coding Standard for the C Programming Language" (PDF). Retrieved 2019-07-16.
  5. ^ "ISO 26262-6:2011 Road vehicles -- Functional safety -- Part 6: Product development at the software level". iso.org. ISO. Retrieved 2019-07-16.
  6. ^ "ISO 26262-6:2018 Road vehicles -- Functional safety -- Part 6: Product development at the software level". iso.org. ISO. Retrieved 2019-07-16.
  7. ^ "AUTOSAR 4.2 General Software Specification" (PDF). autosar.org. Retrieved 2019-07-16.
  8. ^ "AUTOSAR 4.3 General Specification of Basic Software Modules" (PDF). autosar.org. AutoSAR. 2016-11-30. Retrieved 2019-07-16.
  9. ^ MISRA publications
  10. ^ a b "Fact Sheet: MISRA C:2012 (PDF)" (PDF). programmingresearch.com. Retrieved 10 June 2013.
  11. ^ "MISRA Compliance:2016 (PDF)". MISRA. Retrieved 22 July 2016.
  12. ^ "MISRA Compliance:2020 (PDF)" (PDF). MISRA. Retrieved 8 April 2020.
  13. ^ "Achieving MISRA C:2012 Compliance". Parasoft. Retrieved May 29, 2017.
  14. ^ "A brief history of MISRA C". MISRA. 2013-03-18. Retrieved 2014-06-30.
  15. ^ "MISRA C:2012 release date announced". MISRA. 26 February 2013. Retrieved 10 June 2013.
  16. ^ "MISRA C:2012 - Amendment 1 (PDF)". MISRA. April 2016. Retrieved 31 October 2019.
  17. ^ "MISRA C:2012 - Amendment 2 (PDF)". MISRA. February 2020. Retrieved 6 January 2021.
  18. ^ "MISRA C:2012 - Addendum 1: Rule Mapping (PDF)".
  19. ^ "MISRA C:2012 - Addendum 2: Coverage of MISRA C:2012 against ISO/IEC TS 17961:2013 "C Secure" (PDF)".
  20. ^ "MISRA C:2012 - Addendum 3: Coverage of MISRA C:2012 against CERT C (PDF)".
  21. ^ "MISRA".
  22. ^ MISRA GitLab repository
  23. ^ "MISRA C FAQ list." MISRA Consortium
  24. ^ "Helix QAC for C and C++ | Perforce".
  25. ^ "Clearlake Capital-Backed Perforce Software to Acquire Rogue Wave Software | Perforce".
  26. ^ "Klocwork for C, C++, C#, Java, and JavaScript | Perforce".
  27. ^ "C/C++ Built-in Test Configurations". Parasoft. 17 October 2022. Retrieved 9 March 2023.
  28. ^ MISRA conformance checking, PC-lint/FlexeLint, Gimpel Software.
  29. ^ Languages and Standards; iar.com
  30. ^ a b Language subsetting in an industrial context: a comparison of MISRA C 1998 and MISRA C; Les Hatton; University of Kingston; 2004.
  31. ^ Assessing the Value of Coding Standards: An Empirical Study; C.J. Boogerd and L. Moonen; Delft University of Technology; 2008.

Read other articles:

Artikel ini sebatang kara, artinya tidak ada artikel lain yang memiliki pranala balik ke halaman ini.Bantulah menambah pranala ke artikel ini dari artikel yang berhubungan atau coba peralatan pencari pranala.Tag ini diberikan pada Februari 2023. Sympiezomias Klasifikasi ilmiah Kerajaan: Animalia Filum: Arthropoda Kelas: Insecta Ordo: Coleoptera Famili: Curculionidae Genus: EpisomusSchönherr, 1823 Spesies tipe Curculio avarusFabricius, 1801 Diversitas Sekitar 106 spesies Sinonim Epizomus Kono...

 

Kediktatoran SentrokaspiaДиктатура Центрокаспия1918–1918 BenderaStatusTidak diakuiIbu kotaBakuPemerintahanKediktatoranEra SejarahPerang Dunia I• Didirikan 1 Agustus 1918• Pertempuran Baku 26 Agustus-14 September• Jatuhnya Baku 15 September 1918• Gencatan Senjata Mudros 30 Oktober 1918 Didahului oleh Digantikan oleh Republik Sosialis Federasi Soviet Rusia Republik Demokratik Azerbaijan Sunting kotak info • Lihat • BicaraBantuan p...

 

Hypselodoris Hypselodoris variobranchia dari Pulau Sipadan, Kalimantan Klasifikasi ilmiah Kerajaan: Animalia Filum: Moluska Kelas: Gastropoda Subkelas: Heterobranchia Ordo: Nudibranchia Subordo: Doridina Superfamili: Doridoidea Famili: Chromodorididae Genus: HypselodorisStimpson, 1855 Spesies tipe Goniodoris obscuraStimpson, 1855 Spesies Lihat isi teks Sinonim[1] Brachychlanis Ehrenberg, 1831 Brachyclanis [sic] (misspelling) Jeanrisbecia Franc, 1968 (Unnecessary replacement name for ...

Eskudo sa Rehiyon sa Lombardia Bandila sa Lombardia Mapa nga nagpakita sa mga lalawigan sa Lombardia Ang Lombardia (sa Linumbardya: Lumbardia; sa Kinatsila: Lombardía; sa Iningles: Lombardy) maoy usa (1) sa kaluhaan (20) ka rehiyon sa nasod sa Italya. Ang ulohan sa rehiyon maoy ang dakbayan sa Milan Mga lalawigan sa Lombardia Bergamo Brescia Como Cremona Lecco Lodi Mantova (Mantua) Milano (Milan) Monza ug Brianza Pavia Sondorio Varese vteMga Rehiyon sa Italya    AbruzzoWalog s...

 

Building in New York City, United StatesThe Church of St. JohnGeneral informationArchitectural styleTudor RevivalTown or cityKingsbridge, Bronx, New York CityCountryUnited StatesConstruction started1877 (for first church)[1] 1893 (for present church basement)[1]Completed1877 (for first church)[1]1904 (for present church)[1]Demolished1893 (for removal of first church)[1]Cost$21,000 (for 1893 basement)[1]ClientRoman Catholic Archdiocese of New Yor...

 

Pour les articles homonymes, voir Beerbaum. Meredith Michaels-Beerbaum Discipline Saut d'obstacles (CSO) Nationalité Allemagne Naissance 26 décembre 1969 (54 ans) Lieu Los Angeles, États-Unis Taille 1,62 m (5′ 4″)[1] Poids 50 kg (110 lb)[1] Monture Shutterfly, Checkmate, Stella, Quick Star, Bella Donna, Malou, Cantano, Unbelievable , Fibonacci [2] Palmarès Médailles obtenues Compétition Or Arg. Bro. Jeux olympiques 2016 (équipe) Championnat du monde de sau...

Artikel ini membutuhkan rujukan tambahan agar kualitasnya dapat dipastikan. Mohon bantu kami mengembangkan artikel ini dengan cara menambahkan rujukan ke sumber tepercaya. Pernyataan tak bersumber bisa saja dipertentangkan dan dihapus.Cari sumber: Selom – berita · surat kabar · buku · cendekiawan · JSTOR (February 2015) SelomPotongan melintang dari cacing Oligochaeta. Rongga tubuh cacing tersebut mengelilingi tiflosol di bagian tengah.RincianPengidenti...

 

Method of species identification using a short section of DNA Not to be confused with the DNA barcode involved in optical mapping of DNA. DNA barcoding scheme Part of a series onDNA barcoding  DNA barcoding • Metabarcoding   By taxa Microbial Fungal Pollen Algae Aquatic macroinvertebrates fish Other Environmental DNA (eDNA) environmental RNA Metagenomics viruses Metatranscriptomics Amplification PCR Shotgun sequencing High throughput sequencing Extracellular RNA Chimera Healthcare...

 

Sidney FranklinFranklin pada 1920LahirSidney Arnold Franklin(1893-03-21)21 Maret 1893San Francisco, CaliforniaMeninggal18 Mei 1972(1972-05-18) (umur 79)Santa Monica, CaliforniaMakamHollywood Forever CemeterySuami/istriAnn Denitz (satu putra Sidney Jr), Enid Bennett Sidney Arnold Franklin (21 Maret 1893 – 18 Mei 1972)[1] adalah seorang sutradara dan produser asal Amerika Serikat. Seperti William C. deMille, ia mengkhususkan diri dalam mengadaptasi karya-karya sast...

Untuk tempat lain yang bernama sama, lihat Franconville. Franconville, Val-d'OiseMaison Suger (Sekolah Musik Kotamadya) Koordinat: 48°59′20″N 2°13′53″E / 48.9889°N 2.2314°E / 48.9889; 2.2314NegaraPrancisArondisemenPontoiseKantonFranconville (ibukota)AntarkomuneCA Val et Forêt Franconville merupakan sebuah komune di pinggiran barat laut Paris, Prancis. Terletak 17.1 km (10.6 mil) dari pusat kota Paris. Demografi Menurut sensus 1999, populasinya men...

 

Claudio Suárez Suárez nel 2012 Nazionalità  Messico Altezza 178[1] cm Calcio Ruolo Difensore Termine carriera 2009 CarrieraSquadre di club1 1989-1996 Pumas UNAM191 (19)1996-1999 Guadalajara144 (10)1999-2005 Tigres UANL143 (16)2006-2009 Chivas USA64 (9)Nazionale 1992-2006 Messico177 (6)Palmarès  Gold Cup Oro USA-Messico 1993 Oro USA 1996 Oro USA 1998  Copa América Argento Ecuador 1993 Bronzo Bolivia 1997 Bronzo Paraguay 1999  Confederations...

 

2016 Paralympics Parade of Nations Singapore Singapore does not have a formal definition of disability. Singapore signed on to the Convention on the Rights of Persons with Disabilities in 2013 and coordinates the Enabling Masterplan with both government and non governmental organisations. History A discourse of charity generally permeated in Singapore since the post World War 2 period. Support for disabled people was left to the community, who set up various voluntary organisations.[1 ...

Dutch retired footballer Orlando Engelaar Engelaar with PSV in 2010.Personal informationFull name Orlando Wensley EngelaarDate of birth (1979-08-24) 24 August 1979 (age 44)Place of birth Rotterdam, NetherlandsHeight 1.96 m (6 ft 5 in)Position(s) MidfielderYouth career1985–2000 FeyenoordSenior career*Years Team Apps (Gls)2000–2004 NAC 94 (22)2004–2006 Racing Genk 59 (12)2006–2008 Twente 56 (8)2008–2009 Schalke 04 25 (0)2009–2013 PSV 75 (6)2013–2014 Melbourne H...

 

Milhous Teddy Sulistio Ketua DPRD Kota SalatigaMasa jabatan2014 – 2019PresidenSusilo Bambang Yudhoyono Joko WidodoGubernurGanjar PranowoWali KotaYulianto Informasi pribadiLahir27 Juli 1969 (umur 54)Kota Salatiga, Jawa TengahPartai politik Partai Demokrasi Indonesia (1993-1999) PDI-P (1999-sekarang)Suami/istriWahyu Sari AsantriTempat tinggalJalan Merak 63 Klaseman Mangunsari, Sidomukti, Kota SalatigaAlma materUniversitas DiponegoroPekerjaanAnggota Dewan Perwakilan Rakyat Daerah...

 

Naperville redirects here. Not to be confused with Napierville. City in Illinois, United StatesNaperville, IllinoisCityAerial view of downtown Naperville FlagSealMotto: Great Service – All the TimeLocation of Naperville in Will and DuPage counties in IllinoisNapervilleShow map of Chicago metropolitan areaNapervilleShow map of IllinoisNapervilleShow map of the United StatesCoordinates: 41°44′54″N 88°09′57″W / 41.74826°N 88.16585°W / 41.74826; -88.1658...

Set of 17 ivory panels illustrating episodes of Christ's life Christ receiving the cathedral from Otto I, Metropolitan Museum of Art The Magdeburg Ivories are a set of 16 surviving ivory panels illustrating episodes of Christ's life. They were commissioned by Emperor Otto I, probably to mark the dedication of Magdeburg Cathedral, and the raising of the Magdeburg see to an archbishopric in 968.[1] The panels were initially part of an unknown object in the cathedral that has been variou...

 

Species of louse Pediculus humanus Head louse, P. humanus capitis Scientific classification Domain: Eukaryota Kingdom: Animalia Phylum: Arthropoda Class: Insecta Order: Psocodea Family: Pediculidae Genus: Pediculus Species: P. humanus Binomial name Pediculus humanusLinnaeus, 1758 Pediculus humanus is a species of louse that infects humans. It comprises two subspecies:[1][2] Pediculus humanus humanus Linnaeus, 1758 – body louse Pediculus humanus capitis De Geer, 176...

 

Cet article est une ébauche concernant les forces armées des États-Unis et l’Organisation du traité de l'Atlantique nord. Vous pouvez partager vos connaissances en l’améliorant (comment ?) selon les recommandations des projets correspondants. Allied Joint Force Command Naples Insigne du Joint Force Command de Naples Création 1951-2004 : Allied Forces Southern Europe) (AFSOUTH) 2004- : Allied Joint Force Command Naples (JFC Naples) Allégeance Organisation du traité ...

Arcis-le-PonsartcomuneArcis-le-Ponsart – Veduta LocalizzazioneStato Francia RegioneGrand Est Dipartimento Marna ArrondissementReims CantoneFismes-Montagne de Reims TerritorioCoordinate49°14′N 3°42′E49°14′N, 3°42′E (Arcis-le-Ponsart) Superficie15,19 km² Abitanti274[1] (2013) Densità18,04 ab./km² Altre informazioniCod. postale51170 Fuso orarioUTC+1 Codice INSEE51014 CartografiaArcis-le-Ponsart Sito istituzionaleModifica dati su Wikidata · Manuale A...

 

In geometry, property of being directionally dependent This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Anisotropy – news · newspapers · books · scholar · JSTOR (May 2017) (Learn how and when to remove this message) WMAP image of the (extremely tiny) anisotropies in the cosmic microwave background radiation A...