Search:

Type: Posts; User: monk64

Search: Search took 0.01 seconds.

  1. Replies
    11
    Views
    2,579

    You could easily buy a C# book and work through...

    You could easily buy a C# book and work through it...e.g., O'Reilly's Head First book on C#, or one of the Apress books. Why not? It's not like you're going to fill up your brain and have no room...
  2. Replies
    3
    Views
    2,460

    I liked the HeadFirst C# book from O'Reilly a...

    I liked the HeadFirst C# book from O'Reilly a lot. Make sure you get the most recent edition.
  3. Replies
    3
    Views
    1,341

    Trying to wrap my brain around generics...

    At least, I think that's what I think I want to wrap my head around ;-)

    Brief problem statement: How can I write a method signature in a base class that returns a different type depending on the...
  4. Replies
    4
    Views
    1,455

    Any clever construct for a foreach loop in C?

    I have some code where I want to do a for loop, iterating over a fixed set of integers. Unfortunately, the set isn't in any incrementalable order - e.g., it's something like

    { 10, 14, 23, 25 }
    ...
  5. Replies
    3
    Views
    1,009

    Best way to embed data in source code?

    I have a program that reads about 10K of data. This data will never change. It's all constants, etc.

    So it seems I have these options:


    I could just include a ".dat" or ".txt" file with the...
  6. Replies
    1
    Views
    2,803

    Can a macro evaluate ("return") a string?

    Is it possible to "return" a string from a function-like macro? I know macros don't really "return" things, but is it possible to have the macro evaluate to a string?

    For example, I have some...
  7. Trim leading spaces on a string (without returning a new string)

    I wrote a quick function to trim trailing spaces on a string without generating a new string...


    void rtrim (char * s ) {
    int end;
    end = strlen(s) - 1;
    if (end >= 0 && s[end] == '\n')
    ...
  8. Ah, of course. tabstop, you make it so simple. ...

    Ah, of course. tabstop, you make it so simple. Call the function if DEBUG_WANTED, otherwise it's just define'd to blank.

    Thanks much.
  9. Best way to write a DEBUG() output printing macro? My way isn't, apparently...

    This is code for the C99 standard (gcc on linux).

    What I'm trying to do: Write a macro like DEBUG ("some message") that I can drop into code and will only be compiled in if DEBUG_WANTED (or...
  10. Replies
    5
    Views
    13,951

    Bravissimo! That is it. Replacing "1" with...

    Bravissimo! That is it. Replacing "1" with "1ULL" fixed it. Makes complete sense.

    Thanks much - this was quite educational.
  11. Replies
    5
    Views
    13,951

    I thought so, too, but...well, perhaps I have a...

    I thought so, too, but...well, perhaps I have a different problem. I am writing code on 32-bit linux. According to all docs I can find, unsigned long long ints are guaranteed to be 64 bits.


    $...
  12. Replies
    5
    Views
    13,951

    How to for() loop with hex numbers?

    I know, I know, inside the software, a number is a number. But here's my problem...

    I want to do something like this:


    for (i=0; i<=63; i++) {
    if ( ( flags & (1 << i ) ) != 0 )
    ...
Results 1 to 12 of 12