Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6555299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:48:09+00:00 2026-05-25T12:48:09+00:00

In C++ class today, we discussed the maximum possible length of identifiers, and how

  • 0

In C++ class today, we discussed the maximum possible length of identifiers, and how the compiler will eventually stop treating variables as different, after a certain length. (My professor seems to have implied that really long identifiers are truncated.) I posted another question earlier, hoping to see if the limit is defined somewhere. My question here is a little different. Suppose I wanted to test either a practical or enforced limit on identifier name lengths. How would I go about doing so? Here’s what I’m thinking of doing, but somehow it seems to be too simple.

  • Step 1: Generate at least two variables with really long names and print them to the console. If the identifier names are really that unlimited, I am not going to waste time typing them. My code should do it for me.
  • Step 2: Attempt to perform some operations with the variables, such as compare them, or any arithmetic. If the compiler stops differentiating, then in theory, certain arithmetic will break, such as x/(reallyLongA-reallyLongB), since reallyLongA and reallyLongB will be so long that the compiler will just treat them as the same thing. At that point, the division operation will become a division-by-zero, which should crash and burn horribly.

Am I approaching this correctly? Will I run out of memory before I “break” the compiler or “runtime”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:48:09+00:00Added an answer on May 25, 2026 at 12:48 pm

    I don’t think you need to even generate any operations on the variables.

    The following code will generate a redefinition error at compilation time;

    int name;
    int name;
    

    I’d expect you’d get the same error with

    int namewithlastsignificantcharacterhere_abc;
    int namewithlastsignificantcharacterhere_123;
    

    I’d use a macro scripting language to generate successively longer names until you got one that broke. Here’s a Ruby one-liner

    C:>ruby -e “(1..2048).each{|i| puts \”int #{‘variable’*i}#{i};\”}” > var.txt

    When I #include var.txt in a c file, and compile with VS2008, I get the error

    “1>c:\code\quiz\var.txt(512) : fatal error C1064: compiler limit : token overflowed internal buffer”

    and 512*8 chars is the 4096 that JRL cited.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed some code of a colleague today that initialized class variables in the
Today while playing with a De-compiler, i Decompiled the .NET C# Char Class and
we did this problem today in math class to kill time after a quiz,
I have never used DBIx::Class until today, so I'm completely new at it. I'm
Today when I was in computer organization class, teacher talked about something interesting to
Today I happens to find that one C# class can inherit one interface both
Today I ran into the following problem with NUnit. I have a class, that
i was just playing around with the ternary operator in my c class today.
today a weird problem occurred to me: I have a model class in Django
I am learning today about static class functions in C++ and I can't really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.