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

  • Home
  • SEARCH
  • 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 183819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:11:00+00:00 2026-05-11T15:11:00+00:00

I am using Delphi 2007 with all patches and updates. I have a file

  • 0

I am using Delphi 2007 with all patches and updates.

I have a file which is used by two different projects. In that file is a procedure, which I will simplify as follows:

procedure MyProcedure; const   UniqueValue: integer = 0; begin   //some code   Inc(UniqueValue);   //some more code end; 

The Inc() command should fail, because you cannot assign to a constant. In one project, I get an error to that effect (I’ll call that project ‘Accurate’). In the other project, I don’t get any errors (I’ll call it ‘Bogus’). I also don’t get any warnings. I can’t figure out why the compiler lets this incorrect code through.

Here’s what I’ve tried in project Bogus:

1 – Introduce an obvious error, like typing ‘slkdjflskdjf’ in the middle of a line

Result: I get an error,which proves that it is really trying to compile this file.

2 – Delete the .DCU, and rebuild the project

Result: The .DCU is re-generated, again proving that the project is truly compiling this erroneous code.

Does anyone have thoughts on why this behavior would occur? And more specifically, why it would occur in one project but not another? Is there some obscure compiler option to permit assigning to constants?

One final note: Both projects are converted from Delphi 5. Under Delphi 5 with similar code, they both compile fine.

Edit: Thanks for all your help. After changing the assignable typed constants directive, I can get consistent behavior across both projects. I learned something new today…

  • 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. 2026-05-11T15:11:00+00:00Added an answer on May 11, 2026 at 3:11 pm

    There is an option for this called ‘Assignable typed constants’ in Compiler Options. It can also be enabled with ‘{$J+}’ in your code.

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

Sidebar

Related Questions

I have a Windows CGI created with Delphi 2007 using CGIExpert that I need
I have a rather large (freeware) project written with Delphi 2007 which is using
I'm using Delphi 2007 Pro. I have a runtime package that includes a number
HI I'm using Delphi 2007 and have set the MainFormOnTaskBar property to true. The
Using RDO 4.8.0.1184 with Delphi 2006 on Exchange 2007 SP3 I have the following
I'm using Delphi 2007. How can I put a GIF/PNG image on a BitBtn
I`m using Delphi 2009 and want to operate some XML data. I heard that
I am trying to create a code coverage tool using Delphi 2007. My general
I know that it is possible to create .xls files from Delphi using ADO,
After upgrading to Windows 7 all seems to work in my Delphi 2007 version

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.