Chetan Sakhardande wrote:

> WHat is an asynchronous socket? Is it a UDP socket?

An asynchronous socket is one which has had the O_ASYNC flag set on
it, with e.g.

        flags = fcntl(fd, F_GETFL, 0);
        flags |= O_ASYNC;
        fcntl(fd, F_SETFL, flags);
        fcntl(fd, F_SETOWN, getpid());

This will cause the process to receive SIGIO whenever there is data
available.

> Can you use a TCP connection in Asynchronous mode ?

Yes.

> the stdio library is line buffered. Can we change this setting ?

stdio streams default to being line buffered if the stream refers to a
tty device (something for which isatty() returns nonzero), and fully
buffered otherwise.

You can change the buffering mode of a stream using any of setbuf(),
setbuffer(), setlinebuf(), or setvbuf().

> in the foll. code:
> 
> inline void foo(int j)
> {
>       int g;
> }
> 
> int main(void)
> {
>       int     f;
> 
>       foo(f);
> 
>       exit(0);
> }
> 
> According to inline functions def., the foo(f) call in main is expanded to
> the funciton defn. i.e. the compiler does not generate a call.
> 
> However when compiled g++ -g foo.c , and using gdb we get for disass..
> main :

[snip]

> WHy is the call to foo there? why don't i see code of foo instead.

According to the Info file, gcc never inlines functions if it isn't
optimising. Try adding `-O' to your compile switches.

> I tried doing the same without the inline specification and got :

[snip]

> That extra <main+34> in the prev case is funny. What does it mean?

Nothing. gdb is just disassembling too much data. The function ends at
the `ret' statement.

> when using a const instance, we must use a const method defined like :
> ... foo() const;
> 
> What is the meaning of a const method ?

It means that it doesn't modify the object upon which it is called
(i.e. the one to which `this' refers).

> Can this be static also?

It isn't applicable to static (class) methods.

> Is there a man page available for C++ librarires like iostream

No, but there are Info files for libg++ and the iostream library.

-- 
Glynn Clements <[EMAIL PROTECTED]>
  • Problems Chetan Sakhardande
    • Glynn Clements

Reply via email to