473,786 Members | 2,574 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What are SZ array?

I was reading an article regarding .Net arrays and on that article,
the author mentioned something about SZ arrays.

As far as I can tell, SZ arrays are one dimension arrays that are zero
based, am I correct on this? Also, can someone tell me what does “SZ”
stands for?

Thank you.
Jun 30 '08 #1
9 5755
On Mon, 30 Jun 2008 09:31:51 -0700, <qg**********@m ailinator.comwr ote:
I was reading an article regarding .Net arrays and on that article,
the author mentioned something about SZ arrays.

As far as I can tell, SZ arrays are one dimension arrays that are zero
based, am I correct on this? Also, can someone tell me what does “SZ”
stands for?
Without a quote that provides enough context, I don't see how anyone could
answer the question.

Pete
Jun 30 '08 #2
On Jun 30, 11:46*am, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
wrote:
On Mon, 30 Jun 2008 09:31:51 -0700, <qglyirnyf...@m ailinator.comwr ote:
I was reading an article regarding .Net arrays and on that article,
the author mentioned something about SZ arrays.
As far as I can tell, SZ arrays are one dimension arrays that are zero
based, am I correct on this? Also, can someone tell me what does “SZ”
stands for?

Without a quote that provides enough context, I don't see how anyone could *
answer the question.

Pete
Quote:

Hi Pete,

---------------------------
Article quote:

When possible, you should try to stick with single-dimensioned, zero-
based arrays (sometimes referred to as SZ arrays or vectors).
---------------------------

Just curious if the term "SZ arrays" always refer to "single-
dimensioned, zero-based" or is the term used for other types. I am
also curious to know what "SZ" stands for, probably a C/C++ naming
conversion of some sort.

Thanks
Jun 30 '08 #3
This is probably referring to the way that strings were represented in C and
C++, before Unicode and other languages such as VB came along. Strings, in
those days and those languages, were maintained in memory as one-dimensional
arrays of bytes, with each byte containing a character (or 'char'). The
characters in the string were followed by a single byte with a value of
binary zero. This was also called a 'null byte', and one might say of such a
string that it was 'null-terminated'.

The byte array (or char array) was allocated at fixed length (the 'character
buffer') and the byte or character count included space for the terminating
null character. So a string variable could contain any number of characters,
including zero characters, up to the length of the buffer minus one, because
the null-terminating character had to be there to satisfy the C/C++ runtime
code. The C and C++ runtime understood this convention, and the programmer
had to as well, so as to always allocate string variables with enough space
to contain the terminating null character.

This convention has become one of the most popular attack vectors for
hacking - the "buffer overflow" that you always are hearing about - because
it's easy to store into one of those byte arrays a string that's longer than
the size of the array, and programmers are typically negligent about
checking that an input string is not too large to store into the space
allocated.

In Microsoft's ghastly old Hungarian notation - invented by Charles Simonyi
and badly misused by Microsoft programmers for a long time afterwards - it
was common to prefix the name of a string variable with the characters 'sz'
(meaning 'zero-terminated string').

This is still supported in Microsoft's C and C++ languages.

Tom Dacon
Dacon Software Consulting

Jon Skeet will be along in a minute to correct my account of this, so don't
consider this question answered until he has weighed in on the issue :-)
<qg**********@m ailinator.comwr ote in message
news:00******** *************** ***********@s50 g2000hsb.google groups.com...
I was reading an article regarding .Net arrays and on that article,
the author mentioned something about SZ arrays.

As far as I can tell, SZ arrays are one dimension arrays that are zero
based, am I correct on this? Also, can someone tell me what does “SZ”
stands for?

Thank you.
Jun 30 '08 #4
I see from your follow-up post that the original author uses a different
meaning altogether for the term 'SZ array', so you may disregard my
explanation of a much different meaning of the term.

Tom Dacon
Dacon Software Consulting
"Tom Dacon" <td****@communi ty.nospamwrote in message
news:e%******** ********@TK2MSF TNGP06.phx.gbl. ..
This is probably referring to the way that strings were represented in C
and C++, before Unicode and other languages such as VB came along.
Strings, in those days and those languages, were maintained in memory as
one-dimensional arrays of bytes, with each byte containing a character (or
'char'). The characters in the string were followed by a single byte with
a value of binary zero. This was also called a 'null byte', and one might
say of such a string that it was 'null-terminated'.

The byte array (or char array) was allocated at fixed length (the
'character buffer') and the byte or character count included space for the
terminating null character. So a string variable could contain any number
of characters, including zero characters, up to the length of the buffer
minus one, because the null-terminating character had to be there to
satisfy the C/C++ runtime code. The C and C++ runtime understood this
convention, and the programmer had to as well, so as to always allocate
string variables with enough space to contain the terminating null
character.

This convention has become one of the most popular attack vectors for
hacking - the "buffer overflow" that you always are hearing about -
because it's easy to store into one of those byte arrays a string that's
longer than the size of the array, and programmers are typically negligent
about checking that an input string is not too large to store into the
space allocated.

In Microsoft's ghastly old Hungarian notation - invented by Charles
Simonyi and badly misused by Microsoft programmers for a long time
afterwards - it was common to prefix the name of a string variable with
the characters 'sz' (meaning 'zero-terminated string').

This is still supported in Microsoft's C and C++ languages.

Tom Dacon
Dacon Software Consulting

Jon Skeet will be along in a minute to correct my account of this, so
don't consider this question answered until he has weighed in on the issue
:-)
<qg**********@m ailinator.comwr ote in message
news:00******** *************** ***********@s50 g2000hsb.google groups.com...
I was reading an article regarding .Net arrays and on that article,
the author mentioned something about SZ arrays.

As far as I can tell, SZ arrays are one dimension arrays that are zero
based, am I correct on this? Also, can someone tell me what does "SZ"
stands for?

Thank you.

Jun 30 '08 #5
I see from your follow-up post that the original author uses a different
meaning altogether for the term 'SZ array', so you may disregard my
explanation of a much different meaning of the term.
Actually, that’s a pretty good explanation.

So my guess is that the terminology has nothing to do with arrays as
we know them today.

It looks like the term simply stuck since C/C++ string are always
single-dimensioned, zero- based arrays of <chars>, then I can see how
the term got associated to today’s single-dimensioned, zero- based
array of <T>.

Thanks.
Jun 30 '08 #6
This naming convention and more regarding arrays is discussed quite
thoroughly in this month's VisualStudio Magazine.

<qg**********@m ailinator.comwr ote in message
news:00******** *************** ***********@s50 g2000hsb.google groups.com...
I was reading an article regarding .Net arrays and on that article,
the author mentioned something about SZ arrays.

As far as I can tell, SZ arrays are one dimension arrays that are zero
based, am I correct on this? Also, can someone tell me what does “SZ”
stands for?

Thank you.

Jun 30 '08 #7
On Mon, 30 Jun 2008 09:58:10 -0700, <qg**********@m ailinator.comwr ote:
[...]
---------------------------
Article quote:

When possible, you should try to stick with single-dimensioned, zero-
based arrays (sometimes referred to as SZ arrays or vectors).
---------------------------

Just curious if the term "SZ arrays" always refer to "single-
dimensioned, zero-based" or is the term used for other types. I am
also curious to know what "SZ" stands for, probably a C/C++ naming
conversion of some sort.
I've never heard the term before, but based on the quote I'd guess that
the "S" stands for "single-dimension" (or "single-dimensioned") and the
"Z" stands for "zero-based".

It's certainly not part of the standard jargon, and it seems superfluous
to me since in C# all arrays are zero-based.

I'll ignore Tom's flamebait about Hungarian being "ghastly".

Pete
Jul 1 '08 #8
"Peter Duniho" <Np*********@nn owslpianmk.comw rote in message
news:op******** *******@petes-computer.local. ..
On Mon, 30 Jun 2008 09:58:10 -0700, <qg**********@m ailinator.comwr ote:
I'll ignore Tom's flamebait about Hungarian being "ghastly".
Not looking for trouble - just my opinion, but I agree that it might have
been better to have left out the adjective so as not to offend those who are
deeply invested in that particular style. However I do believe that there's
fairly broad agreement that Simonyi's original, good, and very useful
technique of semantic (not variable type) prefixes was badly distorted by
various programming groups at Microsoft.

If you have more to say on the topic - which I am not particularly
interested in pursuing - you might consider cracking a new thread instead of
continuing it here.

Tom
Jul 1 '08 #9
qg**********@ma ilinator.com wrote:
>I see from your follow-up post that the original author uses a
different meaning altogether for the term 'SZ array', so you may
disregard my explanation of a much different meaning of the term.

Actually, that’s a pretty good explanation.

So my guess is that the terminology has nothing to do with arrays as
we know them today.

It looks like the term simply stuck since C/C++ string are always
single-dimensioned, zero- based arrays of <chars>, then I can see how
the term got associated to today’s single-dimensioned, zero- based
array of <T>.
Not "zero-based". "zero-terminated" is the key point. And yes, it's
equally applicable to arrays of wchar_t as char, and can be extended to any
<Twhere the zero value cannot appear inside the data.
>
Thanks.

Jul 2 '08 #10

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

Similar topics

15
2460
by: M.Siler | last post by:
<HTML> <HEAD> <TITLE></TITLE> <SCRIPT> <!-- var factor_val = new Array(8,7) factor_val = 68.8 factor_val = 55
3
1750
by: FroxX | last post by:
Hi all, i have a question. What does those ** mean??? For example: void function(Something **pSomething); I hope someone can help me about it. Thanks,
140
7913
by: Oliver Brausch | last post by:
Hello, have you ever heard about this MS-visual c compiler bug? look at the small prog: static int x=0; int bit32() { return ++x; }
24
3828
by: David Mathog | last post by:
If this: int i,sum; int *array; for(sum=0, i=0; i<len; i++){ sum += array; } is converted to this (never mind why for the moment):
15
2781
by: damian birchler | last post by:
Hi I'm wondering of what type a structure is. Of course, it is a _structure_, but an array isn't an _array_ either. So of what type is a structure? I'd say a pointer, am I right?
14
468
by: Bit byte | last post by:
Came accross the ff code: double array = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; std::vector<double> values(array, array + 9); //<- is this a 2D vector ?
5
2386
by: Cylix | last post by:
this.menus = { root: new Array };
2
1467
by: lamanvic | last post by:
i am trying to create a list of array with random numbers and use the colour sort to sort them to let the negative number on LHS zero in middle and positive number on RHS and print out the sorted array but it doesn't work and i have no idea what is wrong with it can some one please help me thanks using System; using System.Collections.Generic; using System.Text;
89
5772
by: Tubular Technician | last post by:
Hello, World! Reading this group for some time I came to the conclusion that people here are split into several fractions regarding size_t, including, but not limited to, * size_t is the right thing to use for every var that holds the number of or size in bytes of things. * size_t should only be used when dealing with library functions.
0
9497
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,...
0
10363
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, 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...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9962
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 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...
1
7515
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
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...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
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 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.