Re: preprocessor

new topic     » goto parent     » topic index » view thread      » older message » newer message

Bernard Ryan wrote:
> > 
> > I've come up with this to define "structure", it's a little prettier:
> > 
> >     constant RECT_LEFT = 1
> >     constant RECT_TOP = 2
> >     constant RECT_RIGHT = 3
> >     constant RECT_BOTTOM = 4
> >     type RECT (object rect)
> >         if not check_struct ({
> >             rect, "sequence",
> >             {RECT_LEFT, "integer"},
> >             {RECT_TOP, "integer"},
> >             {RECT_RIGHT, "integer"},
> >             {RECT_BOTTOM, "integer"}
> >             }) then
> >             return false
> >         end if
> >         return true
> >     end type
> > 
> 
> Your code idea will only work if you are
> using entries that are the same size.
> 
> Try mixing in fields of different sizes;
> or strings, unions, and nested structures.  


entires can be of different size, why not?

I found out my check_struct() is not possible because i found out this example
doesnt work:

include get.e

procedure call_it (sequence procname)
    call_proc (routine_id (procname), {})
end procedure

procedure i_will_be_called ()
    puts (1, "hello!\n")
end procedure

procedure main ()
    call_it ("i_will_be_called")
    if wait_key () then end if
end procedure

main ()


new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu