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

C structs can't have fields beginning with an uppercase letter #1082

Closed
bgdncz opened this issue Aug 2, 2015 · 2 comments
Closed

C structs can't have fields beginning with an uppercase letter #1082

bgdncz opened this issue Aug 2, 2015 · 2 comments

Comments

@bgdncz
Copy link

bgdncz commented Aug 2, 2015

expecting identifier 'end', not 'Filename'
Filename, Contents : Void*

@bgdncz bgdncz changed the title C struct can C structs can't have fields beginning with an uppercase letter Aug 2, 2015
@jhass
Copy link
Member

jhass commented Aug 2, 2015

I'd say this is a won't fix. Note that the names don't need to match "the real thing" you're mapping, only the sizes do.

@asterite
Copy link
Member

asterite commented Aug 2, 2015

Yes, it's as @jhass says, names don't matter for proper C bindings to work. And because C structs look like regular Crystal objects, accessing their fields look like method calls:

str = SomeLib::Struct.new
str.field = 1
str.field

Method names in Crystal can only begin with lowercase, so that's why there's that restriction.

@asterite asterite closed this as completed Aug 2, 2015
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

No branches or pull requests

3 participants