473,396 Members | 1,940 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,396 software developers and data experts.

Use of With statements

Jon
Hi,

I was wondering if there was any impact on the efficiency of code (either
positive or negative) when using With .... End statements? I also heard that
the use of the keyword caused memory leaks in VB6, is this true??

Thanks,

Jon
Nov 20 '05 #1
6 1039
Hi Jon,

'With' is a shorthand for creating and using a temporary reference
variable The more complex the expression in the With, the better the outcome
in both readability and efficiency.

Regards,
Fergus
Nov 20 '05 #2
* "Jon" <jo*********@nospam.logicacmg.com> scripsit:
I was wondering if there was any impact on the efficiency of code (either
positive or negative) when using With .... End statements? I also heard that
the use of the keyword caused memory leaks in VB6, is this true??


<http://www.google.de/groups?selm=uql5fYMPDHA.2160%40TK2MSFTNGP11.phx.gb l>

In VB Classic, the 'With...End With' block didn't cause memory leaks
when used properly.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Hi Herfried,

How do you 'mis-use' a With - jumping out of it perhaps?

Regards,
Fergus
Nov 20 '05 #4
* "Fergus Cooney" <fi*****@post.com> scripsit:
How do you 'mis-use' a With - jumping out of it perhaps?


ACK. There is a remark in the documentation that you whould not do that.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
Cor
Hi Fergus,
I find it always the problem, if I do have to rearange code, when there is a
with in it, I don't like it, I think it is a matter of taste.
Cor
Nov 20 '05 #6
Howdy Cor,

I agree. When they first came out I thought they were a great idea, then
the lack of a variable, the extra indentation, and extra editing that was
often necessary when doing code rearrangent, like you said, made me discard
them for the most part.

Regards,
Fergus
Nov 20 '05 #7

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

Similar topics

6
by: Bart Nessux | last post by:
Should an if statement have a corresponding else statement? Or, is it OK to have an if statement by itself. For completeness, it seems the two should be together, but from experience I know that a...
68
by: Marco Bubke | last post by:
Hi I have read some mail on the dev mailing list about PEP 318 and find the new Syntax really ugly. def foo(x, y): pass I call this foo(1, 2), this isn't really intuitive to me! Also I...
11
by: Shawn Milo | last post by:
I put this together yesterday, and I thought I'd share it. It works in both IE and Mozilla Firefox. I posted something similar to this months back, but it was much longer, and only worked in IE....
0
by: John Phelan | last post by:
I had a very large number of query statements that I had converted to SQL a long time ago aticipating that I would some day upsize my application. Every now and then when I do an import to a new...
24
by: sureshjayaram | last post by:
In some functions where i need to return multiple error codes at multiple places, I use multiple return statements. Say for ex. if (Found == 1) { if (val == -1) return error1; } else { if...
20
by: Neroku | last post by:
Hello, i would like to know what the serious definition of statements and expressions is: i know an expression are evaluated to a value, i.e: 1 == 2 5+7 foo( 1,2) and a statement is...
2
by: ojorus | last post by:
Hi! Some questions regarding the mysqli-extension (php5) 1) Prepared statements: If I understand things right, prepared statements will give better performance if you make several similar...
3
by: Simone | last post by:
Hello I am pretty new to asp.net :) I have a program that loops through a few sql statements and performs inserts. The problem is the sql statements are different for every upcoming new...
10
by: buffi | last post by:
Am I the only one that thinks that python statements should force whitespace before and after them? Right now this is not enforced and for an example these statements are valid print"hello"...
9
by: John Murtari | last post by:
Folks, We have a fairly busy web site present using PHP 5 to talk to a MySQL 5.0.45 DB on an Apache 1.3 series server. It's spread out over several physical hosts (one DB server), we use DB...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.