Question

Question 2 Whether two types are structurally equivalent is ultimately a matter of inter- pretation: the...

Question 2 Whether two types are structurally equivalent is ultimately a matter of inter- pretation: the language designer decides which differences between two types are significant andwhich ones are not. On page 304 of the textbook, the following algorithm for determining structuralequivalence of two types A and B is given:1 Every type T can be represented as a string sT definedinductively:

If T is a built-in type, sT is its name.

If T is a composite of a sequence of subtypes T1, ..., Tk, then sT consists of the type constructor

used to construct T followed by the strings sT1 , . . . , sTk .
For example, the string sT for the following type T is “struct char pointer int”:

struct T {
    char x;
    int *y;

};

Two types A and B are structurally equivalent if and only if sA = sB.

(a) Argue why you cannot use this definition of type equivalence to decide whether the following

two types A and B are equivalent:

struct A {
    char x;
    struct B *y;
};
struct B {
    char x;
    struct A *y;
};

Homework Answers

Answer #2

answered by: anonymous
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Question 1 Which statement is false about what Data Types defines Question 1 options: What values...
Question 1 Which statement is false about what Data Types defines Question 1 options: What values a variable cannot hold? How much memory will be reserved for the variable? What value a variable will hold? How the program will use the data type? Question 2 Using the structure below, which of the following statements about creating an array (size 20) of structures are not true? struct Employee{     string emp_id;     string emp_name;     string emp_sex; }; Question 2 options:...
Miscellaneous C knowledge. (Put all answers in the same q5.txt file, they’re all short.) (a) [2...
Miscellaneous C knowledge. (Put all answers in the same q5.txt file, they’re all short.) (a) [2 marks] On an old 16-bit computer system and its C compiler,sizeof(double)=8andsizeof(int)=2. Given the two type definitions below, what weresizeof(s)andsizeof(lingling)on that system? Assume that ins, there is no gap between the twofields. typedef struct s { double r[5];int a[5]; } s; typedef union lingling { double r[5];int a[5]; } lingling; (b) [2 marks] Given the following declarations, two questions: What is the type ofq? Whatis...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as possible: What is a checked exception, and what is an unchecked exception? What is NullPointerException? Which of the following statements (if any) will throw an exception? If no exception is thrown, what is the output? 1: System.out.println( 1 / 0 ); 2: System.out.println( 1.0 / 0 ); Point out the problem in the following code. Does the code throw any exceptions? 1: long value...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • A) Assuming that ferrous ammonium sulfate hexahydrate is the limiting reagent in a reaction with ferrous...
    asked 6 minutes ago
  • Ross Hopkins, president of Hopkins Hospitality, has developed the tasks, durations, and predecessor relationships in the...
    asked 17 minutes ago
  • A trapezoidal channel is needed for a location where the bed slope is 0.008 ft/ft, discharge...
    asked 20 minutes ago
  • List and briefly explain each step in the ABCDE technique for examining irrational beliefs that contribute...
    asked 39 minutes ago
  • 1. Find the general solution of the first order linear differential equation: 2*x*dy/dx -y-3/sqrt(x)=0. sqrt() =...
    asked 1 hour ago
  • Fairfield Homes is developing two parcels near Pigeon Fork, Tennessee. In order to test different advertising...
    asked 1 hour ago
  • . For each of the following questions, say whether the random process is reasonably a binomial...
    asked 1 hour ago
  • Please discuss why empathy is so important in light of current events. Please give specific examples
    asked 1 hour ago
  • Describe ONE thing you learned from either Peter singer or Tibor Machan author that compelled you...
    asked 1 hour ago
  • Global logistics firms such as DHL Supply Chain and Global Forwarding or C. H. Robinson Worldwide...
    asked 1 hour ago
  • Please match each factor in adoption of a new product or service to the best match...
    asked 2 hours ago
  • Fatty Acid Synthesis Assignment Explain how the activation of acetyl-CoA carboxylase prevents excess citrate in the...
    asked 2 hours ago