Re: Include Statement

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



Herfried K. Wagner [MVP] wrote:

The VB compiler works in an other way than C/C++ compilers, for example.

Typically includes have been used in C/C++ to make functionality defined in another file available in another file (I do not use C/C++ terminology here because I am not sure if you are familiar with C/C++).

What terminology are you speaking of? I'm a veteran of 21+ different languages. VB.NET, C# and C++/CLR will be my 22, 23, 24. Use ANY references if you like.

This is done automatically by the VB compiler, so there is no need to do it manually.

Do what? IMO, you are limiting your mind to one way of doing things. A silly idea that "includes" are not useful is that same silly idea you said arrays are not useful in MOST cases.

If you are an MVP, you are suppose to be more open minded about general programming ideas.

Remember it is VB.NET that is learning from C/C++ concepts. If it can learn how to do inclusive increments,

string += string

and it learn compiler directives, it can also learn do a #include idea.

So why do other .NET, like C++ languages support a simple include concept? Including VB ASPX files?

The C++ compiler doesn't do all the work for you which the VB compiler does.

huh? Like what?

Also, lets distinguish VB.NET as oppose VB. Different animals.

ASP.NET applications differ in structure from the typical project which is compiled into one binary file.

What does that have to do with Include ideas?

I mean, this is yet another case where VB.NET attempts to inherit standard compiler concepts, but fails to do go all the way, only does for a few things. For example, existing compiler directive

#const USE_VERSION = 1

#if USE_VERSION = 1 then
some v1 code
#elseif USE_VERSION = 2 then
some v2 code
#else then
#error "USE_VERSION not defined"
#end if

Very powerful ideas for programmers. Don't tell me it "isn't necessary."

This is supported in VB.NET because it makes perfect sense even in VB.NET!

And this does not?

#const USE_VERSION = 1

#if USE_VERSION = 1 then
#include "version1.inc"
#elseif USE_VERSION = 2 then
#include "version2.inc"
#else then
#error "USE_VERSION not defined"
#end if

I already mentioned the reason why it is not necessary.

No, you did not.

In C/C++ '#include' is the typical way to make information from one file available to another one.

And why isn't that useful for VB.NET

> In C/C++ you even have to write forward
declarations

Hogwash. Not related at all.

and so on because the help the compiler provides in this regard is rather limited compared to the work the VB compiler does.

Man, and you are an MVP?

BTW, the '#include' concept of C/C++ is rather low-level and not very comfortable to use.

Again, outrageous statements.

namespace MyNewNameSpace
#include "class_dispose.vb"
#include "class_music.vb"
#include "class_whatever.vb"
end namespace

Just add the namespace declaration on each of the files.

What if I don't want to? But even then. Its besides the point.

No need to use text-based inclusion of other files. Code duplication, which was one of the top reasons for using '#include' in C/C++ isn't required and it would not work in VB.

But its ok for ASPX?

Code Duplication? How about library references? How about the idea of single sourcing?

You can have class files and a main

' file: class1.vb
class MyClass1
..
end class

' file: class2.vb
class MyClass2
..
end class

' file: main.vb
Module Module1
Sub Main()
End Sub
End Module

with no namespace requirements and compile it like

vbc main.vb class1.vb class2.vb

which is basically the same ideas of having:

#include "class1.vb"
#include "class2.vb"
Module Module1
Sub Main()
End Sub
End Module

Please, I think you mind is molded about GUI IDE development and now power programming console development methods. Its a side note, but the IDE does blind people of programming methods.

--


.



Relevant Pages

  • Re: C/C++ Compilers Optimization Failed
    ... I used C/C++ Compiler's Optimization. ... >> xor eax, eax ... I am shocked that C/C++ Compiler did not tune optimization very well ...
    (comp.lang.asm.x86)
  • Re: Performance : COBOL trounces C / C++?
    ... When contracting to various ISV's I've had occasion to speed up C/C++ ... ported to z/OS or newly written under z/OS. ... if correct compiler options set, ... Before Tom Ross puts a contract out on me I am not claiming COBOL is slower ...
    (bit.listserv.ibm-main)
  • Re: Include Statement
    ... Typically includes have been used in C/C++ to make functionality defined in another file available in another file. ... This is done automatically by the VB compiler, so there is no need to do it manually. ... accessed *directly* if the namespace they reside in is imported and the types' visibility settings grant permission to access the types/members. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Technologieberatung Dialoge (MFC/C#/HTML)
    ... Ende aller Tage weiterentwickeln. ... Vermutlich hat BCG-Soft soviel Geld für die Integration der BCG-Lib nach MFCNext bekommen, dass BCG jetzt - nachdem der Aktienkurs von MS so stark gefallen ist - mit dem selben Geld nun einfach die ganze Microsoft C/C++ Compiler Abteilung aufkauft. ...
    (microsoft.public.de.vc)
  • Re: Microsoft does cross-platform .NET
    ... Because writing something like 2MB plug-in for operating system that has C/C++ compiler is much more easier then porting complete set of tools for application development like Delphi. ... After all the development environment you will use to target those clients will still be Visual Studio on the top of Windows. ...
    (borland.public.delphi.non-technical)