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

[Arrays] [sigh] who the fuck thought this was a good idea... #880

Closed
fasterthanlime opened this issue Jul 3, 2015 · 5 comments
Closed
Milestone

Comments

@fasterthanlime
Copy link
Collaborator

...to determine the type of a C array from the last element

maybe it was me. But I'm going to find out...

@fasterthanlime fasterthanlime changed the title who the fuck thought this was a good idea [Arrays] [sigh] who the fuck thought this was a good idea... Jul 3, 2015
@fasterthanlime
Copy link
Collaborator Author

Okay so it's because of repeated call to findCommonRoot

@fasterthanlime
Copy link
Collaborator Author

Okay so it's probably the right behaviour

@fasterthanlime
Copy link
Collaborator Author

I'm only mad because I lost 5 hours to this suspecting each and every part of my 3d engine and it turns out it was an ooc bug that I didn't even cause

@fasterthanlime
Copy link
Collaborator Author

Okay so it's not actually the right behavior, cause it takes the last floating point type so if you have:

a := [1.0f, 1.0]

You get an array of doubles, but if you do

a := [1.0, 1.0f]

You get an array of floats, and that's because of this snippet in findCommonRoot:

    basic := func(t1, t2: Type) -> Type {
        if(t1 equals?(type2)) return t1
        if(t1 isNumericType() && t2 isNumericType()) {
            // The root of an integer and a floating point type is the floating point type
            if(t2 isFloatingPointType()) return t2
            return t1
        }

// ... and so on

@fasterthanlime
Copy link
Collaborator Author

Continued in #881..

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

1 participant