Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3335390
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:00:46+00:00 2026-05-18T00:00:46+00:00

In the book Coders at Work (p355), Guy Steele says of C++: I think

  • 0

In the book Coders at Work (p355), Guy Steele says of C++:

I think the decision to be
backwards-compatible with C is a fatal
flaw. It’s just a set of difficulties
that can’t be overcome. C
fundamentally has a corrupt type
system
. It’s good enough to help you
avoid some difficulties but it’s not
airtight and you can’t count on it

What does he mean by describing the type system as “corrupt”?

Can you demonstrate with a simple example in C?

Edit:

  1. The quote sounds polemic, but I’m not trying to be. I simply want to understand what he means.

  2. Please give examples in C not C++. I’m interested in the “fundamentally” part too 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:00:47+00:00Added an answer on May 18, 2026 at 12:00 am

    The obvious examples in C of non-type-safety simply come from the fact you can cast from void * to any type without having to explicitly cast so.

    struct X
    {
      int x;
    };
    
    struct Y
    {
      double y;
    };
    
    struct X xx;
    xx.x = 1;
    void * vv = &xx;
    struct Y * yy = vv; /* no need to cast explicitly */
    printf( "%f", yy->y );
    

    Of course printf itself is not exactly typesafe.

    C++ is not totally typesafe.

    struct Base
    {
       int b;
    };
    
    struct Derived : Base
    {
      int d;
    
      Derived() 
      {
         b = 1;
         d = 3;
      }
    };
    
    Derived derivs[50];
    Base * bb = &derivs[0];
    std::cout << bb[3].b << std::endl;
    

    It has no problem converting the Derived* to a Base* but you run into problems when you try using the Base* as an array as it will get the pointer arithmetic all wrong and whilst all the b values are 1 you may well get a 3 (As the ints will go 1-3-1-3 etc)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the book coders at work , the author asks How do you use
i just was asking about the existence of a headfirst book(iPhone&iPad development) which covers
The book I am reading says that after allocating an object I need to
The book says about a small Windows.Forms program The Windows Forms classes are in
One Book(Object Oriented Programming with C++ by E.Balagurusamy) says that const size = 10;
The Busy Coders Guide to Android Development is a really good book imho. I
Note: This code actually codes from a tutorial book I'm reading at the moment,
Q1 Book suggests that before we register new SqlProfileProvider , we should remove any
Each book can have many authors. And each author can author many books. class
The book, Producing Open Source Software , suggests that it's better to have lengthy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.