Skip to content

[Coding Guideline]: Do not divide by 0 #131

Open
@vapdrs

Description

@vapdrs

Chapter

Expressions

Guideline Title

Do not divide by 0

Category

Mandatory

Status

Draft

Release Begin

unclear

Release End

latest

FLS Paragraph ID

fls_Q9dhNiICGIfr

Decidability

Undecidable

Scope

System

Tags

numerics

Amplification

This guideline applies when unsigned integer or two’s complement division is performed.

Exception(s)

No response

Rationale

Integer division by zero results in a panic, which is an abnormal program state and may terminate the process.

Non-Compliant Example - Prose

When the division is performed, the right operand is evaluated to zero and the program panics.

Non-Compliant Example - Code

let x = 0;
let x = 5 / x;

Compliant Example - Prose

There is no compliant way to perform integer division by zero

Compliant Example - Code

let x = 5 / 5;

Metadata

Metadata

Assignees

Labels

category: mandatoryA coding guideline with category mandatorychapter: expressionscoding guidelineAn issue related to a suggestion for a coding guidelinedecidability: undecidableA coding guideline which cannot be checked automaticallyscope: systemA coding guideline that can be determined applied only when entire source is inspectedstatus: draft

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy