C: A Humbling Language

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Group

    C: A Humbling Language - Presentation Transcript

    1. OSDC 2007 A Humbling Language Rusty Russell
    2. Time Better Spent tcmalloc ● http://goog-perftools.sourceforge.net/doc/tcmalloc.html – tdb ● – ftp://ftp.samba.org/pub/unpacked/tdb lguest ● http://lguest.ozlabs.org –
    3. ABCDEFG HIJKLM NOPQRST UVWXYZ
    4. BCD G LM NOP RS UVW Z
    5. C LM NO S VW Z
    6. C O S
    7. C O S
    8. C S
    9. C S
    10. C
    11. C
    12. C
    13. C: A Historic Language
    14. http://www.thorstenkoerner.de/uploads/thompson_ritchie.jpg
    15. += register entry
    16. foo.c
    17. foo.c preprocessor
    18. foo.c #define FOO 17 preprocessor
    19. foo.c #define FOO(x) (17*(x)) preprocessor
    20. foo.c #ifdef LINUX ... #else preprocessor ... #endif
    21. foo.c #include \"foo.h\" preprocessor
    22. foo.c #include \"foo.h\" foo.h preprocessor
    23. foo.c #include \"foo.h\" foo.h preprocessor #include <stdio.h>
    24. foo.c #include \"foo.h\" foo.h preprocessor #include <stdio.h> stdio.h
    25. foo.c #include \"foo.h\" foo.h preprocessor #include <stdio.h> stdio.h # include <features.h> # include <stddef.h> # include <bits/types.h> #include <libio.h> # include <stdarg.h> #include <bits/stdio_lim.h> #include <bits/sys_errlist.h> # include <getopt.h> # include <bits/stdio.h> # include <bits/stdio2.h> # include <bits/stdio-ldbl.h>
    26. foo.c preprocessor
    27. foo.c preprocessor
    28. foo.c preprocessor foo.i
    29. foo.c preprocessor compiler
    30. foo.c preprocessor compiler
    31. foo.c preprocessor compiler foo.s
    32. foo.c preprocessor compiler assembler
    33. foo.c bar.c baz.c preprocessor compiler assembler
    34. foo.c bar.c baz.c preprocessor compiler assembler linker
    35. foo.c bar.c baz.c preprocessor compiler assembler linker foobarbaz
    36. foo.c bar.c baz.c make preprocessor compiler assembler linker foobarbaz
    37. foo.c bar.c baz.c make preprocessor compiler ccache assembler linker foobarbaz
    38. foo.c bar.c baz.c make preprocessor compiler ccache distcc assembler linker foobarbaz
    39. foo.c bar.c baz.c make preprocessor ccontrol compiler ccache distcc assembler linker foobarbaz
    40. foo.c bar.c baz.c make gcc *.c preprocessor ccontrol compiler ccache distcc assembler linker foobarbaz
    41. 1988
    42. entry void const volatile enum function prototypes
    43. 1999
    44. inline
    45. foo.c bar.c baz.c preprocessor int compiler foo(int x)... assembler linker foobarbaz
    46. foo.c bar.c baz.c preprocessor int compiler foo(int x)... assembler linker foobarbaz
    47. foo.c bar.c baz.c preprocessor foo.h compiler assembler linker foobarbaz
    48. foo.c bar.c baz.c preprocessor foo.h inline int foo(int x)... compiler assembler linker foobarbaz
    49. WTF?
    50. WTF? This isn't a scripting language!
    51. Images from Wikipedia
    52. C
    53. C C
    54. C C CC
    55. C ontrol
    56. C ycles
    57. C ore
    58. C ache
    59. “Sell Me a C!”
    60. The Magic
    61. The Magic
    62. struct list_head { struct list_head *next, *prev; };
    63. struct list_head { struct list_head *next, *prev; }; struct thing { struct list_head elem; ... };
    64. void *kmalloc(size_t size, gfp_t flags);
    65. Just a little magic?
    66. long f(struct foo *a, struct foo *b) { return b – a; }
    67. Magic to get closer to the machine...
    68. struct elems { unsigned int num_elems; struct elem[0]; };
    69. #define memcpy(t, f, n) \\ (__builtin_constant_p(n) ? \\ __constant_memcpy((t),(f),(n)) : \\ __memcpy((t),(f),(n)))
    70. Magic to strengthen language features...
    71. DANGER! Magic to strengthen language features...
    72. #define new(type) \\ ((type *)malloc(sizeof(type))
    73. #define min(x,y) ({ \\ typeof(x) _x = (x); \\ typeof(y) _y = (y); \\ (void) (&_x == &_y); \\ _x < _y ? _x : _y; })
    74. _Bool
    75. #include <stdbool.h>
    76. #include <stdbool.h> #define bool _Bool
    77. #define begin { #define end }
    78. talloc(context, type)
    79. valgrind
    80. C

    guestaa63aaguestaa63aa, 2 years ago

    custom

    1973 views, 0 favs, 1 embeds more stats

    OSDC 2007 opening keynote. Not sure it makes sense more

    More Info

    © All Rights Reserved

    Go to text version
    • Total Views 1973
      • 1972 on SlideShare
      • 1 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 54
    Most viewed embeds
    • 1 views on http://www.slideshare.net

    more

    All embeds
    • 1 views on http://www.slideshare.net

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as innappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel

    Categories

    Tags

    Groups / Events