Give an example of lack of orthogonality in designing of c language?

1 answer

Answer

1263092

2026-06-22 21:00

+ Follow

The design of C language may be examined from the perspective of orthogonality. C language is somewhat inconsistent in its treatment of concepts and language structure, making it difficult for the user to learn (and use) the language. Examples of exceptions follow:

  • Structures (but not arrays) may be returned from a function.
  • An array can be returned if it is inside a structure.
  • A member of a structure can be any data type (except void), or the structure of the same type.
  • An array element can be any data type (except void).
  • Everything is passed by value (except arrays).
  • Void can be used as a type in a structure, but a variable of this type cannot be declared in a function.

    Disadvantages

    Too much orthogonality is also troublesome. This concept may be examined in C language:

    • All statements (including assignment, if and while) return some value, and can be used in expressions.
    • Logic and arithmetic expressions can be intermixed.

    This can cause side effects and cryptic code.

    Since languages need large number of components, too much orthogonality can cause problems. From a language designer's point of view, the most difficult task (and an important one) is to strike a balance.

    (wiki - by Buddhila Ashen Pitigala)

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.