Thread overview
Need help in templates
Mar 25, 2011
Ishan Thilina
Mar 25, 2011
Simen kjaeraas
Mar 25, 2011
Ishan Thilina
Mar 25, 2011
Ali Çehreli
Mar 25, 2011
Regan Heath
Mar 26, 2011
Bekenn
Mar 25, 2011
spir
Mar 25, 2011
Jesse Phillips
March 25, 2011
Hi,

I'm still new to D. I tried to implement a stack using templates. But I get an "Access Violation" error when I try to run a test on the stack that I made.The source code is attached with this mail. Can somebody please point out the error of this code?
March 25, 2011
On Fri, 25 Mar 2011 06:18:21 +0100, Ishan Thilina <ishanthilina@gmail.com> wrote:

> Hi,
>
> I'm still new to D. I tried to implement a stack using templates. But I get an
> "Access Violation" error when I try to run a test on the stack that I made.The
> source code is attached with this mail. Can somebody please point out the
> error of this code?

Line 10:
> 	 Stack! (int) myStack;

Stack!(int) is a class, hence you have to initialize it with new. So this
line should be:

> 	 Stack! (int) myStack = new Stack! (int);

or (perhaps more idiomatic):

> 	 auto myStack = new Stack! (int);


-- 
Simen
March 25, 2011
On 03/24/2011 10:18 PM, Ishan Thilina wrote:
> Hi,
>
> I'm still new to D. I tried to implement a stack using templates. But I get an
> "Access Violation" error when I try to run a test on the stack that I made.The
> source code is attached with this mail. Can somebody please point out the
> error of this code?

I would really love to look at it but like some other people all I get is the following non-D code. ;) I don't know whether the problem is on my end but e-mail and news used to be easier. :)

Ali

> begin 644 main.d
> M;6]D=6QE(&UA:6X[#0H-"FEM<&]R="!S=&0N<W1D:6\[#0H-"FEN="!M86EN
> M*'-T<FEN9UM=(&%R9W8I#0I[#0H@("!W<FET969L;B@B17AE8W5T:6]N(&)E

[snip]
March 25, 2011
@Simen:

Thanks a lot, That solved the problem :).

@Ali:

:s I'm confused, some of the readers has got the attachment correctly :s
March 25, 2011
On Fri, 25 Mar 2011 05:51:11 -0000, Ali Çehreli <acehreli@yahoo.com> wrote:

> On 03/24/2011 10:18 PM, Ishan Thilina wrote:
>  > Hi,
>  >
>  > I'm still new to D. I tried to implement a stack using templates. But I get an
>  > "Access Violation" error when I try to run a test on the stack that I made.The
>  > source code is attached with this mail. Can somebody please point out the
>  > error of this code?
>
> I would really love to look at it but like some other people all I get is the following non-D code. ;) I don't know whether the problem is on my end but e-mail and news used to be easier. :)
>
> Ali
>
>  > begin 644 main.d
>  > M;6]D=6QE(&UA:6X[#0H-"FEM<&]R="!S=&0N<W1D:6\[#0H-"FEN="!M86EN
>  > M*'-T<FEN9UM=(&%R9W8I#0I[#0H@("!W<FET969L;B@B17AE8W5T:6]N(&)E
>
> [snip]

FYI.. that's uuencoded data:
http://en.wikipedia.org/wiki/Uuencoding

it's one of the older style encodings used by NNTP.  Most readers should support it.  If you're on unix there may be a program uudecode which can decode it for you.

R
March 25, 2011
On 03/25/2011 06:18 AM, Ishan Thilina wrote:
> Hi,
>
> I'm still new to D. I tried to implement a stack using templates. But I get an
> "Access Violation" error when I try to run a test on the stack that I made.The
> source code is attached with this mail. Can somebody please point out the
> error of this code?

I occasionnally receive such messages from D's mailing list (only):

> begin 644 main.d
> M;6]D=6QE(&UA:6X[#0H-"FEM<&]R="!S=&0N<W1D:6\[#0H-"FEN="!M86EN
> M*'-T<FEN9UM=(&%R9W8I#0I[#0H@("!W<FET969L;B@B17AE8W5T:6]N(&)E
> M9V%N+BXN(2(I.PT*("`-"B`@(`T*"2!3=&%C:R$@*&EN="D@;7E3=&%C:SL-
> M"@D@;7E3=&%C:RYP=7-H*#(I.PT*"2!R96%D;&X[#0H)#0H)#0H@("!I;G0@
> M8V]U;G0],#L-"@EW:&EL92@A;7E3=&%C:RYI<T9U;&PH*2E[#0H)"0T*"0EM
> M>5-T86-K+G!U<V@H8V]U;G0I.PT*"0EC;W5N="L],C`[#0H)"7T-"@D-"@EW
> M:&EL92@A;7E3=&%C:RYI<T5M<'1Y*"DI>PT*"0EW<FET969L;B@B)60B+&UY
> M4W1A8VLN<&]P*"DI.PT*"0E]#0H)#0H)<F5A9&QN.PT*"0T*("`@<F5T=7)N
> M(#`[#0H@("`-"B`@('T-"@T*#0H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T*"0EI9BAT;W`]/6UA>%-I>F4M,2E[
> M#0H)"0ER971U<FX@=')U93L-"@D)"7T-"@D)96QS97L-"@D)"7)E='5R;B!F
> <86QS93L-"@D)"7T-"@D)?0T*"0T*"7T-"@D-"@``
> `
> end

-- 
_________________
vita es estrany
spir.wikidot.com

March 25, 2011
Ishan Thilina Wrote:

> Hi,
> 
> I'm still new to D. I tried to implement a stack using templates. But I get an "Access Violation" error when I try to run a test on the stack that I made.The source code is attached with this mail. Can somebody please point out the error of this code?

In general I find attaching files to Usenet annoying. Many times it comes in as an encoded file, Web-News is kind enough to let you download the php that generates the page, but not the file. I recommend using a pastbin/gist, this allows the viewing of the file without downloading and usually syntax highlighting.

But you have your answer... so next time.
March 26, 2011
On 3/25/2011 3:34 AM, Regan Heath wrote:
> FYI.. that's uuencoded data:
> http://en.wikipedia.org/wiki/Uuencoding
>
> it's one of the older style encodings used by NNTP. Most readers should
> support it.

Oddly enough, Thunderbird is one that doesn't.