Giter Club home page Giter Club logo

Comments (5)

Zeex avatar Zeex commented on August 18, 2024

Well, I've found the constant responsible for the maximum number of array dimensions:

https://github.com/Zeex/pawn/blob/master/source/compiler/sc.h#L53

I'm not sure if it would be sufficient to change its value alone, but the code compiled.

Is it practical to set it to something bigger than 4?

from compiler.

Arkshine avatar Arkshine commented on August 18, 2024

Be careful, I know SourceMod is using it and BAILOPAN said me it is kind of buggy.
Also, you might need this, which fixes some generation issue: https://hg.alliedmods.net/sourcemod-central/rev/ee044380947f
I don't know if there is others fixes around 4d+.
I'm just saying this will require likely some extended tests and fixes if you're allowing 4d+.

from compiler.

Zeex avatar Zeex commented on August 18, 2024

I've changed the max. number of dimensions to 4 for the sake of experiment, however that seems not enough because 4d array initialization doesn't quite work:

#include <a_samp>

new a[2][2][2][2] = {
    {
        {
            {1, 2}, {3, 4}
        },
        {
            {5, 6}, {7, 8}
        }
    },
    {
        {
            {11, 12}, {13, 14}
        },
        {
            {15, 16}, {17, 18}
        }
    }
};

main() {
    for (new i = 0; i < sizeof a; i++) {
        for (new j = 0; j < sizeof a[]; j++) {
            for (new k = 0; k < sizeof a[][]; k++) {
                for (new l = 0; l < sizeof a[][][]; l++) {
                    printf("a[%d][%d][%d][%d] = %d", i, j, k, l, a[i][j][k][l]);
                }
            }
        }
    }
}

will produce:

a[0][0][0][0] = 1
a[0][0][0][1] = 2
a[0][0][1][0] = 3
a[0][0][1][1] = 4
a[0][1][0][0] = 1 // should be 5
a[0][1][0][1] = 2 // should be 6
a[0][1][1][0] = 3 // should be 7
a[0][1][1][1] = 4 // should be 8
a[1][0][0][0] = 5 // should be 11
a[1][0][0][1] = 6 // should be 12
a[1][0][1][0] = 7 // should be 13
a[1][0][1][1] = 8 // should be 14
a[1][1][0][0] = 11 // should be 15
a[1][1][0][1] = 12 // should be 16
a[1][1][1][0] = 13 // should be 17
a[1][1][1][1] = 14 // should be 18

from compiler.

Misiur avatar Misiur commented on August 18, 2024

I don't know why compiler haven't complained so far, but currently there's a missing array info struct (you ported sc1.c changeset, but missed sc.h one). It prints correct values for me now

Edit: Or not. Still wrong values, argh
E2: It seems I've been looking at wrong file (current sc1 is not patched). Noice. With full patch it works properly, but I've got to reattach ellipsis for multi-dimension.

from compiler.

Misiur avatar Misiur commented on August 18, 2024

Ok, so it doesn't affect ellipsis as it resides in initials, but I was mislead by this thing: ellipsis only supports up to 2 dimensions? Full patch commited.

from compiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.