Skip to content

Make the c_types have stronger C++ types #971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2017
Merged

Conversation

kroening
Copy link
Member

An attempt is made to make the functions in c_types.h return the strongest possible C++ type

@@ -464,14 +464,14 @@ void ansi_c_convert_typet::write(typet &type)
}

if(int8_cnt)
type=is_signed?signed_char_type():unsigned_char_type();
type=is_signed?(typet)signed_char_type():(typet)unsigned_char_type();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use

if(is_signed)
  type=signed_char_type();
else
  type=unsigned_char_type();

to 1) avoid overly long lines and 2) the type casts.

{
typet result=signedbv_typet(config.ansi_c.int_width);
signedbv_typet result=signedbv_typet(config.ansi_c.int_width);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signedbv_typet result(config.ansi_c.int_width); (and several more instances of the same)

{
typet result;
unsignedbv_typet result;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RAII - merge the lines below.

@tautschnig tautschnig merged commit 7f8efa0 into master May 26, 2017
@tautschnig tautschnig deleted the c-types-typing branch June 19, 2017 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants