Skip to main content Accessibility help
×
Hostname: page-component-7bb8b95d7b-qxsvm Total loading time: 0 Render date: 2024-09-30T07:19:01.605Z Has data issue: false hasContentIssue false

Appendix A - Examples

Published online by Cambridge University Press:  03 September 2009

J. C. Huang
Affiliation:
University of Houston
Get access

Summary

Presented in this appendix are four examples showing in various degrees of detail how the present method can be applied to programs written in C++.

Example A.1 shows how to insert constraints into a program to form a subprogram representing an execution path. It also shows how the rules developed in Chapter 3 can be used to simplify the subprogram to the extent possible.

Example A.2 shows that the present method is not only applicable to an execution path but also to the one that includes a loop construct as well. The analysis is done for all possible execution paths in the program, and thus the result constitutes a direct proof of the correctness.

The program in Example A.3 is adopted from a legacy software tool. A portion of this program (printed in boldface type) is difficult to understand. When the present method was used to analyze that part of the program, it was found that it consists of only nine feasible execution paths, despite of the fact that it contains three “for” loops and six “if” statements. Furthermore, it was found that all the path subprograms can be greatly simplified to explicate the function of the program.

The program in Example A.4 is a stack class. It is used to illustrate how the present method can be applied to an object-oriented program.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2007

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Examples
  • J. C. Huang, University of Houston
  • Book: Path-Oriented Program Analysis
  • Online publication: 03 September 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511546990.011
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Examples
  • J. C. Huang, University of Houston
  • Book: Path-Oriented Program Analysis
  • Online publication: 03 September 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511546990.011
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Examples
  • J. C. Huang, University of Houston
  • Book: Path-Oriented Program Analysis
  • Online publication: 03 September 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511546990.011
Available formats
×