For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > August 2006 > some confuse on reading ncurse's source.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author some confuse on reading ncurse's source.
key9

2006-08-24, 10:00 pm

Hi all

On reading , I have some problem to understand these expression means.


1)

char *TERM_data_ptr; // a ptr to a file data
....

int Low_byte;
Low_byte = *((unsigned char *) TERM_data_ptr++);
High_byte = *((unsigned char *) TERM_data_ptr++);


what's this means? TERM_data_ptr++;?



2)

#if defined(__STDC__) || defined(__cplusplus)
#define P_(s) s
#else
#define P_(s) ()
#endif /* __STDC__ */

extern int Get_int P_((void));

I found some function packed on such a macro, why need this? only for name
conflict?


thank you very much!

your key9


Andrei Voropaev

2006-08-25, 4:00 am

On 2006-08-24, key9 <iamkey9@126.com> wrote:
> On reading , I have some problem to understand these expression means.

[...]
> what's this means? TERM_data_ptr++;?

[...]
> extern int Get_int P_((void));
>
> I found some function packed on such a macro, why need this? only for name
> conflict?


Sorry, I don't mean to offend. But looking at your questions, it might be
that you've started to read ncurses code too early. Maybe you should try
to read some book on C programming first? There it should be explained
that ++ does increment by one (whatever is that "one"). It should also
mention about differences in declarations of functions in various
standarts. Really, the book can explain it much better than I :)


--
Minds, like parachutes, function best when open
key9

2006-08-25, 7:00 pm

Well, thank you for your suggest,
But what I need is to know(understand) how ncurses works. the logic itself.

So althought due to my poor c experience , I can still try to read it?

Dosen't it the meaning of "free"?:-)

of course I understand what "int++" or "char++" means.

We are all scrabble on the darkness.


Bill Pursell

2006-08-25, 7:00 pm

key9 wrote:
> Well, thank you for your suggest,
> But what I need is to know(understand) how ncurses works. the logic itself.


> of course I understand what "int++" or "char++" means.


Then why did you previously write:
[color=darkred]

Andrei Voropaev

2006-08-29, 7:59 am

On 2006-08-25, key9 <iamkey9@126.com> wrote:
> But what I need is to know(understand) how ncurses works. the logic itself.
>
> So althought due to my poor c experience , I can still try to read it?


Of course you can try to read it. But without expirience you won't
understand it. Even with expirience it's not easy :) I mean, even
knowing good the language, it is sometimes very hard to follow thru the
code without actually running it in the debugger. Anyway. It would be
more appropriate to lookup questions about C language in the book (or in
comp.lang.c conference :) and here to put questions about why ncurses
does things this way and not the other.

>
> Dosen't it the meaning of "free"?:-)


Hm. What ability to read has to do with the ability to understand? :)


--
Minds, like parachutes, function best when open
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com