-
Notifications
You must be signed in to change notification settings - Fork 285
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
Initialization with not constant expression #36
Comments
Yes, you will need a compiler that supports C99 to build it. If you're building on Windows then you might want to consider MinGW. You will likely also need to modify the Makefile, and you won't be able to build the demo program (which is Linux-only). |
@dlbeer any consideration for dropping VLA as their support is optional in C11? |
On Tue, Jun 06, 2017 at 12:01:02AM -0700, Alexandre Perrin wrote:
@dlbeer any consideration for dropping VLA as their support is
optional in C11?
I suppose an explicit alloca() wouldn't hurt. Would that help with VC++
though? I thought it didn't support designated initializers either, but
I might be wrong about that.
…--
Daniel Beer <dlbeer@gmail.com> http://dlbeer.co.nz/
PGP: BA6E 0B26 1F89 246C E3F3 C910 1E58 C43A 160A 553B
|
No idea about VC++ to be honest, I'm kind of hijacking this issue because I feel uneasy with VLA as they are seldom used in other projects and also are optional in C11.
As for VC++, the situation may improve. While Microsoft has ignored C for long, they've ported OpenSSH to Windows and provide a Linux compatibility now. I think it has/will require them to support some C99 features (and maybe C11), so let's wait and see. |
On Tue, Jun 06, 2017 at 05:07:57AM -0700, Alexandre Perrin wrote:
No idea about VC++ to be honest, I'm kind of hijacking this issue because I feel uneasy with VLA as they are seldom used in other projects and also are optional in C11.
`alloca(3)` isn't a big improvement as failure cannot be easily checked (e.g. the GNU man page say that on failure it can UB). I feel like a library should be as robust as possible, and neither VLA nor `alloca(3)` fit the bill. Allocating on the heap (i.e. `malloc(3)`) should be safer as we don't have any control on how deep the stack is, its limit, and `q->w` and will come with the usual cost of having to free the memory explicitely.
As for VC++, the situation may improve. While Microsoft has ignored C for long, they've ported OpenSSH to Windows and provide a Linux compatibility now. I *think* it has/will require them to support some C99 features (and maybe C11), so let's wait and see.
Fair enough. Perhaps we could allocate a row_average buffer in the
structure at the same time we allocate memory for pixels?
…--
Daniel Beer <dlbeer@gmail.com> http://dlbeer.co.nz/
PGP: BA6E 0B26 1F89 246C E3F3 C910 1E58 C43A 160A 553B
|
Agreed it seems to be the way to go after a quick look. I'll happily work on a patch and PR. |
Hi,
in identify.c :
int row_average[q->w];
It seems some C99 extensions are used (and that are not supported by some compilers :-/
For example VSC++ 2015
The text was updated successfully, but these errors were encountered: