-5

What is the maximum length of variable identifiers of C and C++ in Turbo C++ and Dev-C++?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
sana
  • 410
  • 2
  • 6
  • 24
  • can you please be more specific? – Koushik Shetty Apr 05 '13 at 07:46
  • hi sana!.I am not the one who downvoted you but Please always show some effort before asking the questions here.Otherwise you will be downvoted and might be your question deleted.Please do read the [faq](http://stackoverflow.com/faq) – Freak Apr 05 '13 at 07:46
  • I have researched all other tools like MS visual studio takes 1028 characters for identifier. This is the maximum length of variable name, cannot exceed it. What is length restriction of identifiers in turbo and dev tools ? – sana Apr 05 '13 at 07:49
  • o larki what are you trying to say? what do you mean by `This is the maximum length of variable name, cannot exceed it. What is length restriction of identifiers in turbo and dev tools` – Freak Apr 05 '13 at 07:51
  • http://stackoverflow.com/questions/2352209/max-identifier-length read this page and answer me specifically of the same question for Turbo and Dev. – sana Apr 05 '13 at 07:53
  • `iN `, is the swith you can use on TCC to get the max identifier length. [check this out](http://stackoverflow.com/questions/7343287/how-to-compile-a-program-of-c-language-manually-on-ms-dos-instead-of-borland) – Koushik Shetty Apr 05 '13 at 08:03
  • 2
    It is not clear whether you mean the completely obsolete ancient dinosaur Borland Turbo C++ for DOS, or the semi-outdated Turbo C++ from 2008. Which of these archaeological items are you referring to? The answer will be quite different. – Lundin Apr 05 '13 at 08:11
  • @Lundin "archaeological items" . thats nice :-) – Koushik Shetty Apr 05 '13 at 08:22
  • @Koushik Shetty: TCC is ambigious. The ***primary*** meaning of [TCC](https://en.wikipedia.org/wiki/Tiny_C_Compiler) is [Tiny C Compiler](https://en.wikipedia.org/wiki/Tiny_C_Compiler). Turbo C++ is normally spelled out. – Peter Mortensen May 23 '23 at 14:04
  • @Koushik Shetty: Or is `tcc` the name of the executable (for the compiler)? – Peter Mortensen May 23 '23 at 20:22
  • OK, the name of the executable for the Turbo C++ compiler [is `tcc` or `TCC`](https://stackoverflow.com/questions/7343287/how-to-compile-a-program-of-the-c-language-manually-on-ms-dos-instead-of-borland/7359784#7359784). – Peter Mortensen May 23 '23 at 20:30

3 Answers3

4

If you mean variable length, then it differs from compiler to compiler:

But keep in mind that Annex B of the C++ Standard says that an implementation should support identifiers at least 1024 characters long, but this is not mandatory.

Dev-C++ uses the MinGW or TDM-GCC 64-bit port of GCC as its compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC-based compiler.
AND
Turbo C++ was itself a C++ compiler and integrated development environment and computer language originally from Borland, but most recently it was distributed by Embarcadero Technologies, which acquired all of Borland's compiler tools with the purchase of its CodeGear division in 2008 (ref: Wikipedia)
Please see this as well.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Freak
  • 6,786
  • 5
  • 36
  • 54
2

The C standard, section 5.2.4.1 says:

1) 63 significant initial characters in an internal identifier or a macro name (each universal character name or extended source character is considered a single character)

2) 31 significant initial characters in an external identifier (each universal character name specifying a short identifier of 0000FFFF or less is considered 6 characters, each universal character name specifying a short identifier of 00010000 or more is considered 10 characters, and each extended source character is considered the same number of characters as the corresponding universal character name, if any)

Also have a look at http://c0x.coding-guidelines.com/5.2.4.1.html, but this just what standard says, as @freak mentioned it can also vary from compiler to compiler

Saqlain
  • 17,490
  • 4
  • 27
  • 33
  • Wait, @Zoidberg, did you miss the fact that this answer talkes about [tag:C], not [tag:C++] ? – sehe Apr 05 '13 at 08:11
  • And this is why C is not attractive to Java programmers. –  Apr 05 '13 at 08:12
  • it need not be attractive. its the power it holds that make it so loved by billion others.. – Koushik Shetty Apr 05 '13 at 08:12
  • @Zoidberg, what do you mean? Because there is documented standards or because there are people who read them? – r_ahlskog Apr 05 '13 at 08:13
  • Because C has such a short standard limit on the lengths of identifiers. –  Apr 05 '13 at 08:13
  • @Zoidberg People who write identifiers longer than 63 characters _deserve_ bugs. For the record, C99 increased the minimum number of characters, I believe it was 30-something before. But any implementation is free to use as many characters as they like, the standard only states an absolute minimum. – Lundin Apr 05 '13 at 08:15
  • @Lundin Ah, so that is why frameworks like Spring have so many bugs! –  Apr 05 '13 at 08:16
0

Dev-C++ uses the MinGW port of GCC (g++ for C++), hence it has an unlimited identifier length.

Turbo C++: use the iN switch on tcc to get the maximum identifier length.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Koushik Shetty
  • 2,146
  • 4
  • 20
  • 31
  • A reference: Command-line parameter [`iN`](https://stackoverflow.com/questions/7343287/how-to-compile-a-program-of-the-c-language-manually-on-ms-dos-instead-of-borland/7359784#7359784): *"Max. identifier length"* – Peter Mortensen May 23 '23 at 21:16