Search Results

Search found 38 results on 2 pages for 'yktula'.

Page 2/2 | < Previous Page | 1 2 

  • va_arg with pointers

    - by Yktula
    I want to initialize a linked list with pointer arguments like so: /* * Initialize a linked list using variadic arguments * Returns the number of structures initialized */ int init_structures(struct structure *first, ...) { struct structure *s; unsigned int count = 0; va_list va; va_start(va, first); for (s = first; s != NULL; s = va_arg(va, (struct structure *))) { if ((s = malloc(sizeof(struct structure))) == NULL) { perror("malloc"); exit(EXIT_FAILURE); } count++; } va_end(va); return count; } The problem is that clang errors type name requires a specifier or qualifier at va_arg(va, (struct structure *)), and says that the type specifier defaults to int. It also notes instantiated form at (struct structure *) and struct structure *. This, what seems to be getting assigned to s is int (struct structure *). It compiles fine when parentheses are removed from (struct structure *), but the structures that are supposed to be initialized are inaccessible. Why is int assumed when parentheses are around the type argument passed to va_arg? How can I fix this?

    Read the article

  • Emacs cheat sheet that lists equivalents to everyday vim commands

    - by Yktula
    There were two things that I want to know how to do in Emacs (23.2, *nix): Go to the first character after indentation in a line Go to the first character that's the equivalent to a given character (an equivalent to vim's fx command that goes forward until it hits the x character; maybe C-s (incremental search) is the best way to do this) But, I think it would be better if I had a cheat sheet that listed navigational bindings. Maybe Emacs (self-documenting) can do this on it's own. Is there a list of commands that are equivalent to vim's default commands anywhere? How about a list of navigational key-bindings in Emacs?

    Read the article

  • Dedicating all processor power to a task

    - by Yktula
    Let's say we have a very processor-intensive task at hand which could be effectively parallelized. How can we dedicate all or almost all available processor power to performing that task? The task could be a variety of things, and iterative Fibonacci number generation that saves recorded numbers would be just one example.

    Read the article

  • Behavior with primitive data types' value out of range & C99's PRI* macros

    - by Yktula
    Say we have an 8-bit unsigned integer n (UINT8_MAX=255); what is the behavior of the compiler for n=256? Where can I find a table of default behavior when the value of a data type is out of range for different data types? Is there a pattern to how they behave when set out of range? #include <stdio.h> #include <inttypes.h> uint8_t n = UINT8_MAX; int main() { printf("%hhu ",n++); printf("%hhu",n); return 0; } Compiling with gcc -std=c99 -Wall *.c, this prints: 255 0 Also, is it acceptable to use C99's PRI* macros? How are they named?

    Read the article

  • Emacs: mitigating dependancy on the mouse

    - by Yktula
    In Emacs, how does one emulate mouse button presses and the like using a keyboard? For example, with CEDET's Semantic (included with GNU Emacs 23.2.1), includes can be right clicked to provide a menu; how can I make that menu, and others, with the keyboard, appear as a tooltip or in the minibuffer a la M-` that allows one to access the menu bar?

    Read the article

  • Vim configuration, setting up autocomplete, and columns

    - by Yktula
    How do I set up auto-completion for C? I've heard it's language agnostic. How does this work? Where can I find a list of settings available for vim? I often find that code is usually occupying the left side of my screen when editing. How can I have the next "page" or so of code displayed on the right side, treating the column on the right side as just an extension what's on the left side, with the two scrolling together nicely?

    Read the article

  • Emacs: print key binding for a command or list all key bindings

    - by Yktula
    In Emacs (GNU 23.2, *nix), how can I: list the key sequences bound to a particular command? For example, how can we list all the key sequences that execute save-buffers-kill-emacs, with the output of key sequences bound to it? Assuming we can do this, listing the key sequences bound to goto-line should print the output: M-g g on a default install. list all key-bindings? Does C-h b do this? Would it print my own bindings? I am aware that executing the command directly can print a key sequence it can be activated with, but it doesn't always do so, and a few things happen, including: (1) the output doesn't remain for long, (2) the command is executed. I want a command that lists for me (preferably all) the bindings attached to a given command, without executing the command, or something like that.

    Read the article

< Previous Page | 1 2