Re: Most Economical VB Development Compiler

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"pwrichcreek" <pwrichcreek@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:B69E9830-FD3A-4060-A2AF-D486F3B5F42F@xxxxxxxxxxxxxxxx

> I've tried the VB5 complier that Schmidt suggested. I got a compiler
> error "duplicate definition" from VB5 on the demo source code ...

I would search for '#Const' SubStrings inside your Code-Modules (or better
inside your VB6-Files directly).

This is, what I've found doing a Google-Search:
On MSDN:
http://msdn.microsoft.com/library/en-us/vbenlr98/html/vamsgduplicatedefn.asp
****************Begin excerpt****************
You can only define a conditional compiler constant to have one value. This
error has the following cause and solution:
You specified two different values for the same conditional compiler
constant, for example:
#Const Mac = 0
#Const Mac = 1
Remove one of the definitions.
****************End excerpt****************

Another one, found on:
http://www.oreilly.com/catalog/vbanut/chapter/booklet.html
****************Begin excerpt****************
- Conditional compiler constants are evaluated by the conditional compiler
#If...Then statement block.
- You can use any arithmetic or logical operator in the expression except
Is.
- You can't use other constants defined with the standard Const statement in
the expression.
- According to the documentation, you can't use intrinsic functions in the
expression; e.g., #Const MY_CONST = Chr(13) is illegal. In most cases, VBA
displays a "Compile error : Variable not found" message if you try this. But
there are numerous exceptions. For example, the use of the Int function in
the following code fragment doesn't produce a compiler error, and in fact,
successfully defines a constant ccDefInt whose value is 3:
#Const ccDefFloat = 3.1417
#Const ccDefInt = Int(ccDefFloat)

- When using #Const, you can't use variables to assign the conditional
constant a value.
- Constants defined with #Const can be used only in conditional code blocks.
- Constants defined with #Const have scope only within the module in which
they are defined; i.e., they are private.
- You can place the #Const directive anywhere within a module.
- You can't use the #Const directive to define the same constant more than
once within a module. Attempting to do so produces a "Compile Error:
Duplicate Definition" error message.
- Interestingly, you can define the same constant both through the VB or VBA
interface (see the second item in the "Programming Tips & Gotchas" section)
and using the #Const directive. In this case, the constant defined through
the interface is visible throughout the application, except in the routine
in which the #Const directive is used, where the private constant is
visible.
- The #Const directive must be the first statement on a line of code. It can
be followed only by a comment. Note that the colon, which combines two
complete sets of statements onto a single line, can't be used on lines that
contain #Const.
****************End excerpt****************

Olaf


.



Relevant Pages

  • Re: How to convert Infix notation to postfix notation
    ... and make all strings const save where the intent ... function whose contract is to change the string. ... the compiler "just" prevents the string ... try to do using the pointer you get. ...
    (comp.lang.c)
  • Re: Writing single bits to a file
    ... The 'const' keyword provides the same kind of benefit that prototypes ... enabling the compiler to warn you if it detects the fact that you ... I had not gone and more correctly fixed up the precedence heirarchy (unary ... I like to implement scripting languages for breakfast ...
    (comp.lang.c)
  • Re: const
    ... > const modifiers, ... willing to remove the const'ness with a cast, ... I don't know how good a cross-file compiler could be - it would have to be ... it's a guarantee by the programmer. ...
    (comp.programming)
  • Re: Setting PropertySheet Title (Wizard mode)
    ... If you think of it as optimization, it is probably the wrong reason. ... 'const' captures the purpose of the interface. ... I was trying to use pass-by-value to mean situations where the value ... As an old compiler writer, ...
    (microsoft.public.vc.mfc)
  • Re: Index a #define string
    ... In this case, i wouldn't use an array myself but a const char * const, but ... should one make it of static storage? ... If they were on the stack, where do you think their values ... You mean that the compiler optimises it out. ...
    (comp.lang.cpp)