Tuesday, February 17, 2009

Linux Tips

- Changing Linux root password
http://www.paulspoerry.com/2008/09/06/replace-linux-root-password/

- Ways of saying 'Hello! World' : http://www.fitzrovian.com/hello.html
- sizeof (type) requires parenthese, while sizeof expression
does not.

- How to easily read a declaration from left to right:
transform function argument types from inside out first
move the base type to the end
add outer parentheses if there's an initial *
change every (*...) to ... ->
one -> for each *
move qualifiers, so * const becomes const ->

Example: const int *(**const x [])()

*(**const x [])() const int base type to end
(*(**const x [])()) const int add outer parens
(**const x [])() -> const int remove outer ()
x [] const -> -> () -> const int remove inner ()

array of constant pointers to pointers to functions
returning pointers to constant ints

- p + 1 == &p [1]

-

1 comment:

Ankur Baranwal said...

When you talked about sizeof, here is what I understand. sizeof is an operator and the parenthesis following sizeof does not denote function. Parenthesis is to evaluate the expression.
In other words, parenthesis is not part of sizeof operator, but part of expression whose size is returned.
This is similar to 'return' statement at end of any function. It may or may not have parenthesis after it.