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

Array of struct containing an array fails #234

Closed
sambler opened this issue Feb 21, 2013 · 5 comments
Closed

Array of struct containing an array fails #234

sambler opened this issue Feb 21, 2013 · 5 comments

Comments

@sambler
Copy link
Contributor

sambler commented Feb 21, 2013

Section 5.9 of osl-languagespec states:

It is permitted to have a structure field that is an array, as well as to have an array of struc-
tures. But it is not permitted for one structure to have a field that is another structure. For
example:

struct A {
color a;
float b[4]; // struct may contain an array
};

A d[5]; // Array of structures
color e = d[0].a; // Field of one element of array of struct
d[2].b[4] = 0.25; // Element of a field of a struct in an array

While the last example is an error as the index for b should be < 4,
the array of structs line fails with:-
error: Nested structs with >1 levels of arrays are not allowed: A

I would vote that the compiler is fixed to match this spec rather than just adjusting the spec.

@danieldresser
Copy link

Hey, I'm just starting to play with OSL, and ran into this. Is it likely to change any time soon, or should I be designing around the current behaviour?

@sambler
Copy link
Contributor Author

sambler commented Mar 3, 2015

I brought that up a year ago so I would say design around it for now. Maybe you could convince @lgritz that this needs to be addressed, or provide a fix yourself.

@lgritz
Copy link
Collaborator

lgritz commented Mar 3, 2015

Sorry, this has languished for a while. It's just the right combination of "hard to fix" and "very few people complain." If there's a way to easily design around the problem, I would recommend doing so. If you have a compelling use for this that has no easy workaround, let me know and I can try to find time to take another look.

@danieldresser
Copy link

OK, I'm starting to look at porting a rather complicated shading library to OSL - I should probably hack up an initial working version, and then I'll have a better idea of whether this is going to get in the way.

@lgritz
Copy link
Collaborator

lgritz commented Dec 29, 2018

I'm closing this issue. It's not fixed -- it's a known limitation that we are aware of. But like I said, it's both very hard to fix and not something that people run into or complain about frequently. We may tackle it someday, but it's not on the roadmap in any firm place so I'm not sure there's value in leaving this issue open indefinitely.

@lgritz lgritz closed this as completed Dec 29, 2018
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