Hi group!
WHat is an asynchronous socket? Is it a UDP socket?
Can you use a TCP connection in Asynchronous mode ?
-----------------------------------------------------------------------------
the stdio library is line buffered. Can we change this setting ?
-----------------------------------------------------------------------------
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 :
(gdb) disassemble main
Dump of assembler code for function main:
0x8048490 <main>: pushl %ebp
0x8048491 <main+1>: movl %esp,%ebp
0x8048493 <main+3>: subl $0x4,%esp
0x8048496 <main+6>: movl 0xfffffffc(%ebp),%eax
0x8048499 <main+9>: pushl %eax
0x804849a <main+10>: call 0x80484b4 <foo__Fi>
0x804849f <main+15>: addl $0x4,%esp
0x80484a2 <main+18>: pushl $0x0
0x80484a4 <main+20>: call 0x80483fc <exit>
0x80484a9 <main+25>: addl $0x4,%esp
0x80484ac <main+28>: xorl %eax,%eax
0x80484ae <main+30>: jmp 0x80484b0 <main+32>
0x80484b0 <main+32>: leave
0x80484b1 <main+33>: ret
0x80484b2 <main+34>: movl %esi,%esi
WHy is the call to foo there? why don't i see code of foo instead.
I tried doing the same without the inline specification and got :
Dump of assembler code for function main:
0x8048498 <main>: pushl %ebp
0x8048499 <main+1>: movl %esp,%ebp
0x804849b <main+3>: subl $0x4,%esp
0x804849e <main+6>: movl 0xfffffffc(%ebp),%eax
0x80484a1 <main+9>: pushl %eax
0x80484a2 <main+10>: call 0x8048490 <foo__Fi>
0x80484a7 <main+15>: addl $0x4,%esp
0x80484aa <main+18>: pushl $0x0
0x80484ac <main+20>: call 0x80483fc <exit>
0x80484b1 <main+25>: addl $0x4,%esp
0x80484b4 <main+28>: xorl %eax,%eax
0x80484b6 <main+30>: jmp 0x80484b8 <main+32>
0x80484b8 <main+32>: leave
0x80484b9 <main+33>: ret
End of assembler dump.
That extra <main+34> in the prev case is funny. What does it mean?
and then see what happens inside foo :
with inline
Dump of assembler code for function foo__Fi:
0x80484b4 <foo__Fi>: pushl %ebp
0x80484b5 <foo__Fi+1>: movl %esp,%ebp
0x80484b7 <foo__Fi+3>: subl $0x4,%esp
0x80484ba <foo__Fi+6>: movl 0x8(%ebp),%eax
0x80484bd <foo__Fi+9>: leave
0x80484be <foo__Fi+10>: ret
without inline
Dump of assembler code for function foo__Fi:
0x8048490 <foo__Fi>: pushl %ebp
0x8048491 <foo__Fi+1>: movl %esp,%ebp
0x8048493 <foo__Fi+3>: subl $0x4,%esp
0x8048496 <foo__Fi+6>: leave
0x8048497 <foo__Fi+7>: ret
End of assembler dump.
WHat is the meaning of the extra movl ?
--------------------------------------------------------------------------------
say I have a class defined as follows :
class A {
...
class B {
virtual foo();
};
};
Here is Object B is a component of object A.
Now B is an abstract class, defing virtual foo, and I want to inherit
from B say C and D which define foo according to their requirements.
What I want to do is in main() , I will instantiate only a type A.
However, I want to some way instantiate the correct component of A
depending upon some parameters I provide.
How do I do this? Conceptually this may be ok, but does this have any
serious performance limimtations ?
--------------------------------------------------------------------------------
when using a const instance, we must use a const method defined like :
... foo() const;
What is the meaning of a const method ?
Can this be static also?
Is there a man page available for C++ librarires like iostream
--------------------------------------------------------------------------------