The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

Browse by Tags

All Tags » c (RSS)
  • Re: Yeah, the sysadmin's a jerk...

    [quote user="alegr"] [quote user="Wolftaur"]As far as I know, no C compiler exists for any one's complement machine.[/quote] IIRC, ANSI C standard requires two's complement machine. [/quote] Specification Lad to the rescue! [quote user="C99, 6.2.6.2(2)"] For signed...
    Posted to Forum by Spectre on 10-30-2008
  • Re: Homebrew Security

    [quote user="danixdefcon5"] int [ ] codez = { 0xffb002b4, 0xc93180b2, 0x13cdf630, 0x909090c3 } int main(int argc, char **argv) { codez(); } Guess what this does. [/quote] I know what it doesn't do — compile. Here, FTFY: int main[] = { 0xffb002b4, 0xc93180b2, 0x13cdf630, 0x909090c3 };
    Posted to Forum by Spectre on 10-25-2008
  • Ubuntu in C

    Wow. I can install Ubuntu in C. Also, C is called "No localization" in C. I wonder if I can get Ubuntu in other programming languages like Fortran, BASIC, Javascript, Perl, Python, and Java.
    Posted to Forum by samanddeanus on 09-24-2008
  • Re: Function returning a function - in C

    [quote user="joeyadams"] If you want the function to return a pointer to itself rather than a structure containing that pointer, you can do that too: ~SNIP~ [/quote] Well... except it doesn't work. Have you tested it? [quote user="joeyadams"] By the way, how do I disable HTML...
    Posted to Forum by Spectre on 06-29-2008
  • Re: Arrays in a C union and memory alignment.

    The compiler isn't likely to put any padding between the doubles, but I don't think there's something prohibiting it to do it. You can do the following, which is less risky, but potentially less efficient: #define FooArray(foo) { &(foo.x), &(foo.y), &(foo.z) } void IUseFoo(Foo...
    Posted to Forum by Spectre on 06-26-2008
  • Re: C Code Creep

    [quote user="Spikeles"] Because, on some architectures, char is not 1 byte in size. [/quote] That's false. [quote user="C99, 6.5.3.4(3)"] When [sizeof is] applied to an operand that has type char, unsigned char, or signed char, (or a qualified version thereof) the result is 1...
    Posted to Forum by Spectre on 06-13-2008
  • Re: Function returning a function - in C

    I'm not sure if there's a way to do exactly what you want, but you can enclose the function pointer in a struct and be happy: #include <stdlib.h> #include <stdio.h> struct container { struct container (* call)(int); }; struct container look_I_return_myself(int p) { struct container...
    Posted to Forum by Spectre on 05-30-2008
  • Re: Speed Challenge 34 - I laugh in the face of warnings of danger.

    I'm a bit late, but I thought I'd try my hand for the warnings program. This program will probably segfault, though it shouldn't surprise anyone -- it does a lot of pointer munging for the heck of it. 50+ warnings, mostly unique, 256 bytes of source, so about one warning every 5 characters...
    Posted to Forum by zokar on 04-04-2008
  • Re: More secure than strncpy()? strncpy_s()!

    [quote user="morbiuswilters"] Spectre is incorrect, though, it is meant for copying null-terminated strings, that's why it halts on a null in the source string. If your source isn't null-terminated and your size is larger than the source, you get read errors, so it's obviously meant...
    Posted to Forum by Spectre on 03-19-2008
  • Re: /var~

    Posted to Forum by MasterPlanSoftware on 02-05-2008
Page 1 of 3 (27 items) 1 2 3 Next >
Powered by Community Server (Non-Commercial Edition), by Telligent Systems