Skip to content
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

more const in root #5409

Merged
merged 1 commit into from Feb 6, 2016
Merged

more const in root #5409

merged 1 commit into from Feb 6, 2016

Conversation

WalterBright
Copy link
Member

No description provided.

@@ -73,7 +73,7 @@ struct File
size_t size;
stat_t buf;
ssize_t numread;
char* name = this.name.toChars();
const(char)* name = this.name.toChars();
Copy link
Member

Choose a reason for hiding this comment

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

Just use auto?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about that, and decided explicit was better when doing this conversion.

Copy link
Member

Choose a reason for hiding this comment

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

That will mean we're going to have to go back and change them all again when toChars starts returning string

Copy link
Member Author

Choose a reason for hiding this comment

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

It'll all have to be scrutinized line by line anyway, because of 0 termination, rewrite to toString, etc. It's not encapsulated well at all.

Copy link
Member

Choose a reason for hiding this comment

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

Eh

@@ -40,7 +40,7 @@ struct File
_ref = 0;
buffer = null;
len = 0;
name = cast(FileName*)n;
name = n;
Copy link
Member Author

Choose a reason for hiding this comment

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

@yebblies here's an example of as const use grows, the casts can be removed.

@yebblies
Copy link
Member

yebblies commented Feb 6, 2016

Auto-merge toggled on

yebblies added a commit that referenced this pull request Feb 6, 2016
@yebblies yebblies merged commit e126d3d into dlang:master Feb 6, 2016
@WalterBright WalterBright deleted the constFile branch February 6, 2016 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants