team bbl


On an Intel x86 system under both FreeBSD and Linux, if we execute the program that prints "hello, world" and do not call exit or return, the termination status of the program, which we can examine with the shell, is 13. Why?


When is the output from the printfs in Figure 7.3 actually output?


Is there any way for a function that is called by main to examine the command-line arguments without (a) passing argc and argv as arguments from main to the function or (b) having main copy argc and argv into global variables?


Some UNIX system implementations purposely arrange that, when a program is executed, location 0 in the data segment is not accessible. Why?


Use the typedef facility of C to define a new data type Exitfunc for an exit handler. Redo the prototype for atexit using this data type.


If we allocate an array of longs using calloc, is the array initialized to 0? If we allocate an array of pointers using calloc, is the array initialized to null pointers?


In the output from the size command at the end of Section 7.6, why aren't any sizes given for the heap and the stack?


In Section 7.7, the two file sizes (475570 and 11410) don't equal the sums of their respective text and data sizes. Why?


In Section 7.7, why is there such a difference in the size of the executable file when using shared libraries for such a trivial program?


At the end of Section 7.10, we showed how a function can't return a pointer to an automatic variable. Is the following code correct?

 int f1(int val) {     int     *ptr;     if (val == 0) {         int     val;         val = 5;         ptr = &val;     }     return(*ptr + 1); } 

    team bbl

    Advanced Programming in the UNIX Environment
    Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)
    ISBN: 0321525949
    EAN: 2147483647
    Year: 2005
    Pages: 370

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net