I have two books saying different things about the #region directive. One
says that all code within #region does not affect the compilation process
in any way, while the other states that the entire region is marked for a
pre-processor directive which does affect the compilation process.
I was wondering which is accurate? Is #region/#endregion just a text
editor visualization tool with not effect otherwise, or is everything
within the block seen as one big preprocessor command?
TIA
-John 6 1920
there really isnt a preprocessing phase in the compilation process these
were c++ days. the 'pre-processing' phase is now part of the lexigraphical
analyzer portion. code falling within these blocks affect conditional
compilation which means that the text is re-arranged before the compiler
proper sees. so in fact, pre-processing does affect the compilation process.
"John" <Je***@Sbcgloba lDotNetwork.NoS pam> wrote in message
news:pa******** *************** ****@SbcglobalD otNetwork.NoSpa m... I have two books saying different things about the #region directive. One says that all code within #region does not affect the compilation process in any way, while the other states that the entire region is marked for a pre-processor directive which does affect the compilation process.
I was wondering which is accurate? Is #region/#endregion just a text editor visualization tool with not effect otherwise, or is everything within the block seen as one big preprocessor command?
TIA -John
Interesting, because I recently took a c# skills test and I got the following question wrong. I think I answered D
4 The #region preprocessor directive:
a. defines a region of code to be executed before the rest.
b. Marks an area of text with a comment
c. Defines a region of code to be compiled with 'debug on'
d. Marks an area of text to be treated as native call.
I looked through all the documenatation and the best I could figure was it was B.
"Alvin Bruney" <vapordan_spam_ me_not@hotmail_ no_spamhotmail. com> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. there really isnt a preprocessing phase in the compilation process these were c++ days. the 'pre-processing' phase is now part of the lexigraphical analyzer portion. code falling within these blocks affect conditional compilation which means that the text is re-arranged before the compiler proper sees. so in fact, pre-processing does affect the compilation process. "John" <Je***@Sbcgloba lDotNetwork.NoS pam> wrote in message news:pa******** *************** ****@SbcglobalD otNetwork.NoSpa m... I have two books saying different things about the #region directive. One says that all code within #region does not affect the compilation process in any way, while the other states that the entire region is marked for a pre-processor directive which does affect the compilation process.
I was wondering which is accurate? Is #region/#endregion just a text editor visualization tool with not effect otherwise, or is everything within the block seen as one big preprocessor command?
TIA -John
b is probably correct, #region is used to subsection code in the editor, its
a language feature that exists strictly for nicer IDE's.
Its actually the only one I can think of that is there for that singular
purpose.
blasted OE, looses commenting markers when changing from html to plain text,
<g>
-----end post-----
"Not Available" <no**********@b .com> wrote in message
news:Fq******** *************@t wister.nyc.rr.c om...
Interesting, because I recently took a c# skills test and I got the
following question wrong. I think I answered D
4 The #region preprocessor directive:
a. defines a region of code to be executed before the rest.
b. Marks an area of text with a comment
c. Defines a region of code to be compiled with 'debug on'
d. Marks an area of text to be treated as native call.
I looked through all the documenatation and the best I could figure was it
was B.
"Alvin Bruney" <vapordan_spam_ me_not@hotmail_ no_spamhotmail. com> wrote in
message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. there really isnt a preprocessing phase in the compilation process these were c++ days. the 'pre-processing' phase is now part of the lexigraphical analyzer portion. code falling within these blocks affect conditional compilation which means that the text is re-arranged before the compiler proper sees. so in fact, pre-processing does affect the compilation
process. "John" <Je***@Sbcgloba lDotNetwork.NoS pam> wrote in message news:pa******** *************** ****@SbcglobalD otNetwork.NoSpa m... I have two books saying different things about the #region directive.
One says that all code within #region does not affect the compilation
process in any way, while the other states that the entire region is marked for
a pre-processor directive which does affect the compilation process.
I was wondering which is accurate? Is #region/#endregion just a text editor visualization tool with not effect otherwise, or is everything within the block seen as one big preprocessor command?
TIA -John
"John" <Je***@Sbcgloba lDotNetwork.NoS pam> wrote in message
news:pa******** *************** ****@SbcglobalD otNetwork.NoSpa m... I have two books saying different things about the #region directive. One says that all code within #region does not affect the compilation process in any way, while the other states that the entire region is marked for a pre-processor directive which does affect the compilation process.
I was wondering which is accurate? Is #region/#endregion just a text editor visualization tool with not effect otherwise, or is everything within the block seen as one big preprocessor command?
Hi John,
The #region/#endregion preprocessing directives have no effect on the
resulting compiled code. They exist simply for the benefit of IDE's to
group a block of code during editing.
Joe
-- http://www.csharp-station.com
On Sun, 28 Sep 2003 15:27:53 -0600, Joe Mayo wrote: They exist simply for the benefit of IDE's to group a block of code during editing.
Thanks for the reply. I don't see why microsoft chose this method as
opposed to a more normal one such as a derivation of //, /*, or /// for
regions. Using a preprocessor directive that has nothing to do but make
comments seems so odd. Is there a reason that they didn't use a normal
commenting alternative, instead, for this concept?
TIA
-John
"John S." <Je***@Sbcgloba lDotNetwork.NoS pam> wrote in message
news:pa******** *************** *****@Sbcglobal DotNetwork.NoSp am... On Sun, 28 Sep 2003 15:27:53 -0600, Joe Mayo wrote:
They exist simply for the benefit of IDE's to group a block of code during editing.
Thanks for the reply. I don't see why microsoft chose this method as opposed to a more normal one such as a derivation of //, /*, or /// for regions. Using a preprocessor directive that has nothing to do but make comments seems so odd. Is there a reason that they didn't use a normal commenting alternative, instead, for this concept?
Although you can add text to the #region directive, that is not a comment,
but is really a description of the region. IMO, a comment would be
additional syntax for expressing what a region does and would not be a good
substitute because you would have to define a region comment standard that
has a begin and end. Also, IMO, a comment is not representative for what a
region accomplishes. The real purpose of a region is to help organize code.
In the IDE, you can use a region to expand and collapse large blocks of
code. This makes navigation and reading code a whole lot easier. An
example of this is when defining a custom collection class in VS.NET. Every
time you implement an interface and press the tab key, VS.NET adds a new
region to your type with skeleton stubs for interface members. By the time
you've completed collection class implementation, you have dozens of
members. The regions that categorize and classify these methods according
to interface make the class a whole lot easiser to navigate and use. This
is just one way that regions can help organize code, which could also be by
member type (events, methods, properties, etc). If all you have is Notepad,
they lack benefit because there is no way to expand and collapse them, but
if you're using an IDE, they are great.
Joe
-- http://www.csharp-station.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Altramagnus |
last post by:
I have a complicated Region object, which I need to draw the outline, but
not fill
How can I convert the Region object to GraphicsPath object?
or How can I draw the outline of the Region object?
|
by: Jim |
last post by:
Are #region a bad thing or are they good?
As far as I see it #region's are a bad thing as they let lazy programmmers
have large and bloated methods divided into regions that then appear as
small methods, they also show bad analsys and design when used in this
way......
Thoughts?
|
by: Brian Basquille |
last post by:
Hello all,
Quick question!
How would i keep a point inside a region? For example, the mouse pointer.
You should be able to move the mouse around in this region but not anywhere
outside it.
How would i go about doing this?
|
by: Brian Basquille |
last post by:
Another question for ye all..
How do i check if a Region has entered another region?
Up until now, i've been checking if rectangles (or images converted into
Rectangles) have been visible in a Region (Region.IsVisible) but all
parameters in IsVisible seem to be for Rectangles / points.
To check if a Region is in another Region, i'd probably have to use the
Region.Intersect.. am i on the right track?
|
by: Steven T. Hatton |
last post by:
All of the following terms are used in some way to describe where and how a
name is relevant to a particular location in a program: visible,
declarative region, scope, potential scope, valid, introduced, used,
potentially evaluated and accessible. They all seem to have subtle
difference in meanings.
Any positive contribution to the following will be appreciated.
Here is my attempt to make sense of these:
| |
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
I'm working on examples of programming in several languages, all
(except PHP) running under CGI so that I can show both the source
files and the actually running of the examples online. The first
set of examples, after decoding the HTML FORM contents, merely
verifies the text within a field to make sure it is a valid
representation of an integer, without any junk thrown in, i.e. it
must satisfy the regular expression: ^ *?+ *$
If the...
|
by: Sagaert Johan |
last post by:
i have a control that uses a region to make it non rectangular
when i try to to remove the region by calling this.Region.Makeinfinite() the
control keeps its non rectangular Region.
if i call RecreateHandle() after calling Region.Makeinfinite() it works.
I Don't understand why it does not work if i don't call RecreateHandle();
Johan
|
by: Grant Edwards |
last post by:
I've recently switched from Jed to Emacs for editing python
source, and I'm still stumped as to how one indents or dedents
a region of code. In Jed it's 'C-c <' or 'C-c >'. Google has
found several answers, but none of them work, for example I've
tried bot "C-c tab" and "C-c C-r" based on postings Google has
found, but neither appears to actually _do_ anyting.
--
Grant Edwards grante Yow! You were s'posed...
|
by: Chris Thomasson |
last post by:
This region allocator is not dynamic and can be fed with a buffer residing
on the stack of the calling thread. Therefore, you can use this in an
environment which does not have a heap; its basically analogous to `alloca'.
However, it does not align each buffer on a boundary sufficient for _any_
type. Instead, it dynamically calculates the types alignment requirements
and mutates the offset accordingly. This makes it more efficient wrt...
|
by: Chris M. Thomasson |
last post by:
Here is the initial crude implmentation which compiles under Comeau with no
warnings:
___________________________________________________________________
#include <cassert>
#include <cstdlib>
#include <new>
#include <list>
template<typename T, std::size_t BUFDEPTH = 1024>
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |