473,405 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

#if constants craziness!

Option Compare Text

Module Module1

Sub Main()

#If MyString = "ABC" Then
MsgBox("You have been compiled!")
#End If

End Sub

End Module
----------------------

Create a new project , console app is ideal, and paste in the above code.

Create a conditional compilation(configuration properties->Build) variable...MyString="ABC"

The #if may or may not compile. On my machine as displayed above it compiles. But if I comment out the Option Compare line, then it will not compile.

According to the docs #if is not subject to Option Compare, specifically, it says all #if's assume Option Compare Text!

This is a PITA.

OK now for some really big craziness. Ensure the Option Compare is not commented out....

Use: CommonProperties->Build->Option Compare to change the value to Text, apply it try build, then change it to Binary, build and see what happens. The value here seems to interfere with the option compare specified at the top of the source!

If you can reproduce this problem then please respond. If not, then please don't worry. I am not mental and I can do that consistently just with a simple project and the source code above.

Regards,
--------------------------------
From: Chris Nurse

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>8E0kFTBMtUyIrau+V7WQRQ==</Id>
Nov 21 '05 #1
1 1311
I can reproduce it. Binary works and Text does not. It also seems to be
flaky when u change the option compare statement at the top, sometimes you
need to cut it, build replace and build again and it works.

There is probably a rational explaination to do with code page settings or
something depending on your regional locale

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Chris Nurse via .NET 247" <an*******@dotnet247.com> wrote in message
news:eW**************@TK2MSFTNGP10.phx.gbl...
Option Compare Text

Module Module1

Sub Main()

#If MyString = "ABC" Then
MsgBox("You have been compiled!")
#End If

End Sub

End Module
----------------------

Create a new project , console app is ideal, and paste in the above code.

Create a conditional compilation(configuration properties->Build) variable...MyString="ABC"
The #if may or may not compile. On my machine as displayed above it compiles. But if I comment out the Option Compare line, then it will not
compile.
According to the docs #if is not subject to Option Compare, specifically, it says all #if's assume Option Compare Text!
This is a PITA.

OK now for some really big craziness. Ensure the Option Compare is not commented out....
Use: CommonProperties->Build->Option Compare to change the value to Text, apply it try build, then change it to Binary, build and see what happens.
The value here seems to interfere with the option compare specified at the
top of the source!
If you can reproduce this problem then please respond. If not, then please don't worry. I am not mental and I can do that consistently just with a
simple project and the source code above.
Regards,
--------------------------------
From: Chris Nurse

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>8E0kFTBMtUyIrau+V7WQRQ==</Id>

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Raymond Hettinger | last post by:
Comments are invited on the following proposed PEP. Raymond Hettinger ------------------------------------------------------- PEP: 329
0
by: David W. Fenton | last post by:
Today I was working on a hideous old app that I created a long time ago that does a lot of showing/hiding/resizing of fields on one of the forms. I had used constants to store reference values for...
4
by: Amadelle | last post by:
Hi all and thanks again in advance, What is the best way of defining global constants in a C# application? (A windows application with no windows forms - basically a set of classes). Would it be...
8
by: Marty | last post by:
Hi, I'm new to C#, I used to code in VB.NET. Where is the best place to declare all my constants and global objects in my C# project to have them accessible globally? I have an event logger...
34
by: newsposter0123 | last post by:
The code block below initialized a r/w variable (usually .bss) to the value of pi. One, of many, problem is any linked compilation unit may change the global variable. Adjusting // rodata const...
6
by: PC | last post by:
Gentlesofts, Forgive me. I'm an abject newbie in your world, using VB 2005 with the dot-Net wonderfulness. So, I'm writing a wonderful class or two to interface with a solemnly ancient...
17
by: Neil Cerutti | last post by:
The Glk API (which I'm implementing in native Python code) defines 120 or so constants that users must use. The constants already have fairly long names, e.g., gestalt_Version, evtype_Timer,...
2
by: Leslie Sanford | last post by:
I want to define a set of floating point constants using templates insteand of macros. I'd like to determine whether these constants are floats or doubles at compile time. In my header file, I have...
54
by: shuisheng | last post by:
Dear All, I am always confused in using constants in multiple files. For global constants, I got some clues from http://msdn.microsoft.com/en-us/library/0d45ty2d(VS.80).aspx So in header...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.