Variable names

Variable names

Is there a limit on variable name length?

publicaciones de 6 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Hi,
We haven't set any limit. Any specific concern which we might have overlooked?

Thanks
-Rama

Quoting Rama Kishan Malladi (Intel)
Hi,
We haven't set any limit. Any specific concern which we might have overlooked?

Thanks
-Rama

Just that something like:

struct Variable {
	char* id;
	...
};

Variable* v = new Variable();
v.id = new char[strlen(str) + 1];
strcpy(v.id, str);

would require 2 memory allocations as opposed to one, as in:

struct Variable {
	char id[64];
	...
};

Variable* v = new Variable();
strcpy(v.id, str);

Of course, there are work-arounds, but, since there is a limit on string length, to me, it makes sense to put a limit on identifier length as well...

I'd prefer there to be no limit, because that forces us to be more clever about memory management, and memory management is a big part of any realistic parallel optimization effort.

Quoting Rama Kishan Malladi (Intel)
Hi,
We haven't set any limit. Any specific concern which we might have overlooked?

Thanks
-Rama
It would be convenient to set limit 256, as a string.

I've already gone through the work and made design decisions to support arbitrary-length variable names, so it would put my design at a relative disadvantage to change the spec now.

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya