dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]System.Text.StringBuilder exposed


From: Gopal V
Subject: [DotGNU]System.Text.StringBuilder exposed
Date: Fri, 30 Aug 2002 23:14:21 +0530
User-agent: Mutt/1.2.5i

Hi All,
    This is still me doing my work (as Lead Developer "At Large" of
pnetlib) .. to try and find the bugs hidden deep in pnetlib code ..

The bugs I have encountered so far have been "duh ! why did I do that"
category .. I'm currently testing out the sample code in All.xml and 
have encountered a few small issues .. (Those who need the examples.cs
code can get it from me)

StringBuilder sb=new StringBuilder("123456789");
Console.WriteLine(sb);

gives no output ... which explains why I failed to do the number
formatting mods (ie optimise it to use StringBuilder..) correctly.

See code below to understand how it's easy to make mistakes under the 
influence of drinking (coffee) and overspeeding ("5000 lines a week
is way over the speed limit , My good man !").

----------------------
    public StringBuilder(String value)
            {
                if(value != null)
                {
                    buildString = String.NewBuilder(null, MinCapacity);
                }
                else
                {
                    int capacity = value.Length;
                    if(capacity < MinCapacity)
                    {
                        capacity = MinCapacity;
                    }
                    buildString = String.NewBuilder(value, capacity);
                }
                maxCapacity = Int32.MaxValue;
                needsCopy = false;
            }
        }
----------------------

In short we really need regression tests here ! .. please do contribute..
(and call me "Mr Bugs" please ...)

Gopal
-- 
The difference between insanity and genius is measured by success


reply via email to

[Prev in Thread] Current Thread [Next in Thread]