Comments (5)
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.
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.
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.
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.
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)
- Stop Compiler
- Samp includes error HOT 1
- Packed string access in enum arrays
- Optimization of conditional expressions
- Can't compile on linux! HOT 2
- when to wait for the next build? HOT 1
- Classes and objects in PAWN? HOT 3
- Compiler giving false positive warnings (240) HOT 4
- Named only parameters. HOT 3
- External natives are always in the header, even when not used. HOT 2
- Constant "Run time error 19: "File or function is not found"" error
- default include path for standard libraries? HOT 1
- The Application was unable to start correctly.(0xc000007b) HOT 1
- fatal error 100: cannot read from file: "Pawn.CMD" HOT 1
- fatal error 100: cannot read from file: "interception"
- [DIY] Build from source on Apple Chip M1 using rosetta2 HOT 6
- `initialization data exceeds declared size` when using progressive initialization with an array size 1
- `const` can be specified for a function argument more than once
- error compile
- pawnc reports wrong filenames and line numbers on warning number 203 & 213
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compiler.