Search:

Type: Posts; User: -Adrian

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    9
    Views
    234

    Way cool! :D

    Way cool! :D
  2. I'm only aware of Fortran in that respect. I...

    I'm only aware of Fortran in that respect. I think it's due to guarantees the language makes regarding aliasing. Maybe as LLVM improves further, Rust could benefit from such guarantees too, but...
  3. Replies
    2
    Views
    107

    What part confuses you? This looks like what one...

    What part confuses you? This looks like what one would expect. Do you know that an int takes 4 bytes¹ of memory? So the union only takes 4 bytes even though it contains 3 ints. If it was a regular...
  4. If you insist on discussing semantics, you won't...

    If you insist on discussing semantics, you won't get a universal answer.


    void foo(int a); // passing an integer
    void foo(int* a); // passing a pointer to an integer

    You know these two, you...
  5. The former – it passes the address, not the...

    The former – it passes the address, not the content.
  6. Replies
    5
    Views
    249

    if (num2 == 0) { // not '0' However, comparing...

    if (num2 == 0) { // not '0'

    However, comparing a float to 0 isn't quite as simple as that either, so I would recommend you declare num2 as an integer (num1 can stay float). It's complicated ;)
  7. Replies
    5
    Views
    249

    You could try that yourself as an exercise! Place...

    You could try that yourself as an exercise! Place an extra check inside the else-if section for division. If the user tries to divide by 0, you could then print a message and go to the next iteration...
  8. Replies
    7
    Views
    254

    exercise2.cpp:17:19: error: C++ requires a type...

    exercise2.cpp:17:19: error: C++ requires a type specifier for all declarations
    void read_ages(&name, n) // member function
    ^
    exercise2.cpp:17:25: error: unknown type name 'n'
    ...
  9. Replies
    7
    Views
    254

    Do you come from another programming language?...

    Do you come from another programming language? You should have learned about function calls and scopes before touching the class construct. Go back to the section about functions and how to define...
  10. Replies
    5
    Views
    249

    Without having put much thought into this, here...

    Without having put much thought into this, here is a quick solution:


    if (op == 'x')
    {
    cout << "Are you sure you would like to exit?" << endl;
    cout << "Enter y to exit" << endl;
    ...
  11. Replies
    2
    Views
    152

    int main (void) { int a = 5; // 'a' starts...

    int main (void)
    {
    int a = 5; // 'a' starts existing here
    printf ( "\n a : %d", a);

    function(); // 'b' starts existing and stops existing here

    return 0; // 'a'...
  12. You should post this in the C++ forum, as this...

    You should post this in the C++ forum, as this isn't C.

    What the error message do you get? Also, you're missing a template declaration on line #20, in case that wasn't just lost in the copy/paste.
  13. // 4 byte object, 8 byte (64bit) address char...

    // 4 byte object, 8 byte (64bit) address
    char x[4];
    sizeof(x) -> gives 4
    sizeof(&x) -> gives 8

    // 16 byte object, 8 byte address
    struct sockaddr_in sa;
    sizeof(sa) -> gives 16...
  14. Replies
    13
    Views
    254

    Yes, I haven't tried XCode myself but it looks...

    Yes, I haven't tried XCode myself but it looks good on the surface and I suspect the Clang/LLDB integration is nice for writing C.
  15. Replies
    13
    Views
    254

    CodeBlocks for Mac appears to not be maintained....

    CodeBlocks for Mac appears to not be maintained. Have you considered XCode¹?

    ¹ Personally I'm against beginners using these unwieldy IDEs, because they have so many knobs and dials yet obscure the...
  16. Show us the code you have tried already, for...

    Show us the code you have tried already, for instance, you probably went with a loop of some kind.
  17. #include int foo (int q) // this...

    #include <stdio.h>

    int foo (int q) // this function is run when you call it, not wherever you write it down
    {
    int y = 1;
    printf("q=%i\n", q);
    return (q + y); // if q=5, this will...
  18. Thread: Slow forum?

    by -Adrian
    Replies
    11
    Views
    576

    @webmaster Did you check your logs for origin of...

    @webmaster Did you check your logs for origin of traffic? If the board was hammered by small number of IPs, then setting up something like fail2ban would be safer bet for the future, assuming this...
  19. Replies
    13
    Views
    294

    Oh, you're using templates! Sorry, totally missed...

    Oh, you're using templates! Sorry, totally missed that. As laserlight said, move the implementation into the header.
  20. Replies
    13
    Views
    294

    Have you added utilities.cpp to your project as a...

    Have you added utilities.cpp to your project as a dependency, so that it gets linked? (I don't know how VS works)
  21. Replies
    13
    Views
    294

    Put it as close to your use as is sensible, e.g....

    Put it as close to your use as is sensible, e.g.


    int main()
    {
    rngT rng;
    const auto result = Roll_DX_Ntimes(rng, 1, 2);
    }

    Avoid global variables except for edge cases (which are...
  22. Replies
    13
    Views
    294

    You're initializing an object in the header. That...

    You're initializing an object in the header. That is the problem, not the typedef.
  23. Replies
    13
    Views
    294

    And post your code if you still run into issues.

    And post your code if you still run into issues.
  24. Thread: Slow forum?

    by -Adrian
    Replies
    11
    Views
    576

    I feel the same. Does the admin need help? I'm...

    I feel the same. Does the admin need help? I'm going to assume that whoever is sending all these queries isn't so sophisticated that static or dynamic block rules couldn't be put into place. I don't...
  25. I'm not sure what exactly your question is, but...

    I'm not sure what exactly your question is, but the errors point to:


    Your glibc being too old
    Apache needing to be compiled with mod_so module support


    So naturally, you'd want to upgrade...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4