Re: void pointer syntax

2012-05-16 Thread Chris Cain
On Wednesday, 16 May 2012 at 11:12:19 UTC, Stephen Jones wrote: Cain: My understanding is that D is based on "no proper ways of doing things" just get the job done. The use of properties when you can use public access baffles me. So long as you are I suppose "proper way of doing things" isn't

Re: void pointer syntax

2012-05-16 Thread dennis luehring
>Am 16.05.2012 13:12, schrieb Stephen Jones: just throw aways your sensless void pointer or whatever idea - create a base interface or better base-class - everything else is just damn wrong btw: all oop widget sets for c++, java or else are haveing a widget base class that works like people t

Re: void pointer syntax

2012-05-16 Thread Era Scarecrow
On Wednesday, 16 May 2012 at 11:12:19 UTC, Stephen Jones wrote: Ali your post above, and T your post in the other forum (Simpsons bit) is sort of what I was after. I tried both interface and abstract class but not outright super class. The problem I have with the solution is the same problem I

Re: void pointer syntax

2012-05-16 Thread Stephen Jones
case you'd downcast to the common base class. If some one knows void pointer syntax that would be helpful. As I understand it there is a type called size_t that takes the address of as a a value. Can I make an array of these and simply initialize each with &button1, &cursor,

Re: void pointer syntax

2012-05-15 Thread dennis luehring
Am 14.05.2012 20:40, schrieb Stephen Jones: Ali Çehreli post got your answer - see the last example of the post news://news.digitalmars.com:119/[email protected] but first: try to understand how the base-class, interface stuff realy works - you will got the same problems in every

Re: void pointer syntax

2012-05-15 Thread H. S. Teoh
class. > If some one knows void pointer syntax that would be helpful. As I > understand it there is a type called size_t that takes the address > of as a a value. Can I make an array of these and simply initialize > each with &button1, &cursor, etc? Also, how is size_t freed?

Re: void pointer syntax

2012-05-15 Thread Ali Çehreli
the array to. Exactly! :) Either you or the compiler must keep track of it. void* removes any trace of type information. > If some one knows void pointer syntax that would be helpful. import std.stdio; void main() { int i; double d; void*[] array; array ~= cast(void*)&

Re: void pointer syntax

2012-05-15 Thread Chris Cain
y int vertCount();// getter public @property int vertCount(int); // setter void draw(){} } If some one knows void pointer syntax that would be helpful. As I understand it there is a type called size_t that takes the address of as a a value. Can I make an array of these and simply initi

Re: void pointer syntax

2012-05-15 Thread Stephen Jones
ferent sorts of widgets into a single array was so I did not have to track what each type of object was; not tracking what each object in the array is I have no means of knowing what to cast each Widget in the array to. If some one knows void pointer syntax that would be helpful. As I understan

Re: void pointer syntax

2012-05-14 Thread H. S. Teoh
On Mon, May 14, 2012 at 12:05:53PM -0700, H. S. Teoh wrote: > On Mon, May 14, 2012 at 08:40:30PM +0200, Stephen Jones wrote: > > I want an array of different classes of objects. I tried to > > subsume the differences by extending the classes under a single > > interface/abstract class/super class (

Re: void pointer syntax

2012-05-14 Thread H. S. Teoh
On Mon, May 14, 2012 at 08:40:30PM +0200, Stephen Jones wrote: > I want an array of different classes of objects. I tried to > subsume the differences by extending the classes under a single > interface/abstract class/super class (3 different approaches) all > to no avail as I could not access the

void pointer syntax

2012-05-14 Thread Stephen Jones
I want an array of different classes of objects. I tried to subsume the differences by extending the classes under a single interface/abstract class/super class (3 different approaches) all to no avail as I could not access the public variables of the instantiated classes while storing them in an

Re: pointer syntax

2010-10-29 Thread spir
On Fri, 29 Oct 2010 12:57:39 -0400 bearophile wrote: > I have added your example here: > > http://d.puremagic.com/issues/show_bug.cgi?id=4539 Thank you for your answers. (I'm pleased to see I was not totally stupid to find this behaviour somewhat nonsensical ;-) .) Denis -- -- -- -- -- -- --

Re: pointer syntax

2010-10-29 Thread bearophile
I have added your example here: http://d.puremagic.com/issues/show_bug.cgi?id=4539 Bye, bearophile

Re: pointer syntax

2010-10-29 Thread Simen kjaeraas
spir wrote: Hello, I have a little issue with pointer syntax: auto toS = &("abc") ; // ok auto toS = &"abc" ; // ok auto toI = &(1) ; // Error: constant 1 is not an lvalue auto toI = &1 ; // Error: c

pointer syntax

2010-10-29 Thread spir
Hello, I have a little issue with pointer syntax: auto toS = &("abc") ; // ok auto toS = &"abc" ; // ok auto toI = &(1) ; // Error: constant 1 is not an lvalue auto toI = &1 ; // Error: constant 1 is not an

Re: about pointer syntax

2010-10-14 Thread bearophile
> D dynamic arrays are not bad, but they are not very efficient, I meant associative array, sorry.

Re: about pointer syntax

2010-10-14 Thread bearophile
spir: > (Hope you don't mind if I send other bits of code to be improved that way?) Feel free to show them, if I am busy other people may give you an answer. The worst that may happen is that no one answers you. > Right. I think at keeping explicit defaults like "int element = 0" for > docume

Re: about pointer syntax

2010-10-14 Thread Andrej Mitrovic
On 10/14/10, bearophile wrote: > Generally the field dereferencing doesn't require the "(*symbol).name", in D > you use "symbol.name". > Pointers to arrays are possible, but quite uncommon in D. I'm not sure, but I think function pointers (the C syntax ones, not variables declared with function/

Re: about pointer syntax

2010-10-14 Thread spir
On Thu, 14 Oct 2010 17:16:23 -0400 bearophile wrote: > spir: > > > As a way to start learning D by practicing, I'm trying to implement a > > symbol table as linked list: see prototype code of the structs below. > > (Hints about good D coding welcome :-) > > I have modified your code a little:

Re: about pointer syntax

2010-10-14 Thread bearophile
spir: > As a way to start learning D by practicing, I'm trying to implement a symbol > table as linked list: see prototype code of the structs below. (Hints about > good D coding welcome :-) I have modified your code a little: struct Symbol { string name; int element; Symbol* next;

about pointer syntax

2010-10-14 Thread spir
Hello, As a way to start learning D by practicing, I'm trying to implement a symbol table as linked list: see prototype code of the structs below. (Hints about good D coding welcome :-) 2 little questions about pointers: 1. To please the compiler, I had to wrap dereferencing in parens, like in