Variable names

Variable names

Is there a limit on variable name length?

6 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

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.

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen