Thread: I'm new to this board but not to C .

  1. #16
    Registered User
    Join Date
    May 2006
    Posts
    903
    It's fun to see how you think you are so great and so l33t when all you are really doing is just obfuscate a simple piece of code by using defines and removing all spaces and indentation...

    Take this !

    Code:
    #include <stdio.h>
    struct W{char m,M[4??),w;void x(char
    *W)??<w^=w;while(w[W]!=0)putchar(W[w
    ]^M[w++&#37;5??));}W():m(040),w(0){char*
    X="d@PLfAU\x05P)sHEMoTTPF""\31";for(
    ;w<5;w++[M??)=m++);x(X);}}w;main(){}
    (This is not my code, I took it from someone on another forum).

  2. #17
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    I'm sure you realize that without binary,we
    wouldn't be capable of posting on this forum.

    I'm tired of trying to help people read my code.

    Here's what it looks like when I can read it!
    The real issue here is that you came to us expecting comments not compliments. You have to realise that, if you are going to write code for other people or at least show code to other people, you have to consider them. Posting here is not an exception to the fact, because if you go to anyone knowledgeable and they look over your code, they have certain biases and expectations, such as indentation and "intelligent," thoughtful (thought provoking?) code.

    People here generally expect, unless otherwise stated, that they want to write Standard and portable code. This is where we are most knowledgeable. We do not know everything.
    Binary is my life [...]

    I use 0x8 because I am always changing the
    value and having fun watching it.
    I don't want to have to remove the "0x" just
    to add it later. And the whole point of defining zero and one was because I intended somebody to change it so you get
    characters like 'A' and 'Z' for example.
    All of that is great. If you want to write code for yourself, do it in the manner you prefer. There is a whole culture for obfuscated C work where you might get better appreciation for your effort. But there are legitimate points here and there is no reason to bark at other people just for doing what you asked. Fishing for compliments is a horrible personality trait, especially when we had no idea you were intentionally writing a messy program.

    I hope they sticky this to preserve your hypocritical ways.
    Last edited by whiteflags; 06-24-2007 at 03:12 PM.

  3. #18
    Registered User
    Join Date
    Jun 2007
    Location
    Lees Summit Missouri
    Posts
    11
    Hey,I used to hex edit save files of computer games and change
    money,experience,HP etc. In a pure binary file you don't have indentation or spaces.

    I only use C because it's an easier way to show somebody extreme binary counting
    than to send a gigabyte text file.

    Now is the time to put aside your weak human side and join me in remaking this world!

  4. #19
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I don't want to have to remove the "0x" just to add it later.
    Why add it later if you don't need it at all? I mean, does your brain really think 1B before 27? I'm seeing a distinct lack of logic in your statements, and it looks like it all boils down to "I like how hexadecimal looks".

    >And the whole point of defining zero and one was because I intended somebody to change it
    >so you get characters like 'A' and 'Z' for example.
    I believe the comment was referring to your use of character codes and not character literals:
    Code:
    #define zero '0'
    #define one '1'
    The effect is the same, but now it's easier to read and more portable.

    >When I came here,I honestly thought that nobody would have seen a binary counting program like this.
    That's fine, but now you should know that many of us are professional developers with a decade or more of experience in multiple languages. The chances of you finding a simple program (and binary counting is very simple) we won't recognize on sight are rather slim.

    >I've never bet another person who reads or writes binary.
    You weren't here when we were posting in binary for fun.

    >And don't say "more readable" .
    >You can only read what you have learned.
    That doesn't make sense. When we say "readable", we expect you to have crossed the threshold where you would understand well presented code. If you would be ignorant of the code regardless of the presentation, the term doesn't apply to you.

    >I'm tired of trying to help people read my code.
    You weren't trying to begin with.

    >Here's what it looks like when I can read it!
    I can still read it easily. You'll have to try harder.
    My best code is written with the delete key.

  5. #20
    Registered User
    Join Date
    May 2006
    Posts
    903
    This almost sounds like a joke from a senior member...

  6. #21
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    It's probably Dean.
    My best code is written with the delete key.

  7. #22
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Quote Originally Posted by honorable_sir View Post
    Hey,I used to hex edit save files of computer games and change
    money,experience,HP etc. In a pure binary file you don't have indentation or spaces.

    I only use C because it's an easier way to show somebody extreme binary counting
    than to send a gigabyte text file.
    Okay, I think that's boring. But because I want to use C for more than counting numbers, my opinion doesn't matter. Fortunately, most of us are born with ten fingers, and I can count faster than any abacus you want to code in whatever magical base just because you like it.
    Now is the time to put aside your weak human side and join me in remaking this world!
    Richard Stallman is going to kick your ass before you can even try to conquer the world with a calculator. Stop while your alive and allowed a compiler. You might ruin the world for the rest of us.

  8. #23
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Code:
    for(c=0;c<=L;c++){s[c]=_0;}
    Ever heared about memset? I dobt you can beat its performance...
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  9. #24
    Registered User
    Join Date
    Jun 2007
    Location
    Lees Summit Missouri
    Posts
    11
    I apologize.
    I suppose I over reacted. I often take things personally.

    Just a few things to remember.

    Yes,I do think 1B before 27 . I practice binary and hexadecimal more than decimal.

    I write C programs ONLY for the purpose of outputting integer sequences.

    If a C compiler can parse my code,I consider it "readable" .

    I have never met anybody else who actually knows as much about C programming
    as you guys. I'm sorry I underestimated you.

    I WAS trying to help people read my code. I don't usually comment code or do anything
    as neat as the first post. The second version I posted is how I actually read code.

    Overall,thanks for your comments. I don't exactly have much of a social life(as you might have guessed). I'm not famliliar with what most humans do.

    The only friends I get along with are my family,church people,and other geeks who like base conversion.

    So I'm very sorry for talking the way I did.

    If you ever need help with things that do involve integer sequences,I'll try to help with that.

    Perhaps I can try figuring out how to install that indent tool to indent my stuff.

    BTW vart,thanks for telling me about memset.
    I'm guessing it loads AL with the char and then does a rep stosb.

  10. #25
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    If a C compiler can parse my code,I consider it "readable" .
    It is not readable... It is just compileable

    Compiler - compiles your code... People read it... So it will be readable only when other person can read AND understand it...
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  11. #26
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    I for one, being a human don't find hex naturally easy to read (as decimal is), so what's is wrong with decimal? You claim you don't want to add the "0x" later if it's needed...? Why, it takes a fraction of a second...

  12. #27
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    Code:
    #include <stdio.h>
    
    main(t,_,a)
    char *a;
    {return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
    main(-86, 0, a+1 )+a)):1,t<_?main(t+1, _, a ):3,main ( -94, -27+t, a
    )&&t == 2 ?_<13 ?main ( 2, _+1, "%s %d %d\n" ):9:16:t<0?t<-72?main(_,
    t,"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+\
    ,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/\
    +k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){n\
    l]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#\
    n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
    ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;\
    #'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/")
    :t<-50?_==*a ?putchar(a[31]):main(-65,_,a+1):main((*a == '/')+t,_,a\
    +1 ):0<t?main ( 2, 2 , "%s"):*a=='/'||main(0,main(-61,*a, "!ek;dc \
    i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}
    A little test: what happens in this program?
    http://www.cs.cf.ac.uk/Dave/C/node4....00000000000000
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

  13. #28
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Yes,I do think 1B before 27 .
    You're in the minority.

    >I write C programs ONLY for the purpose of outputting integer sequences.
    Then why even bother? :P

    >If a C compiler can parse my code,I consider it "readable" .
    Heheh, a C compiler can parse a mess of crap that would take you years to figure out. Is that what you consider readable?

    >I have never met anybody else who actually knows as much about C programming as you guys.
    If you're the toughest kid in the cul-de-sac, it can be a surprise when you go to the big city.

    >BTW vart,thanks for telling me about memset.
    ...

    >I'm guessing it loads AL with the char and then does a rep stosb.
    What it does is initialize a sequence of characters with a specified value. How it does that is implementation-defined. Assuming an implementation is dangerous, especially in assembly. The performance characteristics of your code can change wildly between processors, and a logical solution wouldn't be used by the implementation because it was too slow or too expensive for the target system.

    Without getting into off-topic details, I know that even on recent Pentiums, rep stosb failed to beat a mov/dec/jnz loop, but confusingly enough, rep movsb did. Since you're so into speed, why not see if you can beat memset's performance?
    My best code is written with the delete key.

  14. #29
    Registered User
    Join Date
    Jun 2007
    Location
    Lees Summit Missouri
    Posts
    11
    >Yes,I do think 1B before 27 .
    You're in the minority.
    duh

    >I write C programs ONLY for the purpose of outputting integer sequences.
    Then why even bother? :P
    Cause it's what I was born to do.

    >If a C compiler can parse my code,I consider it "readable" .
    Heheh, a C compiler can parse a mess of crap that would take you years to figure out. Is that what you consider readable?
    Yes

    >I have never met anybody else who actually knows as much about C programming as you guys.
    If you're the toughest kid in the cul-de-sac, it can be a surprise when you go to the big city.
    It's a surprise all right. The surprise is that somebody responded to my post at all!

    >I'm guessing it loads AL with the char and then does a rep stosb.
    What it does is initialize a sequence of characters with a specified value. How it does that is implementation-defined. Assuming an implementation is dangerous, especially in assembly. The performance characteristics of your code can change wildly between processors, and a logical solution wouldn't be used by the implementation because it was too slow or too expensive for the target system.
    True. I used to write a lot of programs in DOS ASM using only 16 bit code.
    These days that stuff doesn't have much place but I still think in those
    terms. I also used to write and run 6502 programs in a simulator.
    I like simplicity over speed. I even had thoughts about
    inventing an emulated CPU that accessed only bits and had operations
    to clear,set,or invert them. Sure it wouldn't be capable of doing as much as any other CPU
    but it would be identical to how I think(which is very limited)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need a second opinion - code error and i cant see it
    By bigfootneedhelp in forum C Programming
    Replies: 19
    Last Post: 10-25-2007, 06:02 AM
  2. Constructor problem
    By rebel in forum C++ Programming
    Replies: 22
    Last Post: 01-11-2006, 06:45 AM
  3. function trouble
    By rebel in forum C++ Programming
    Replies: 4
    Last Post: 12-21-2005, 05:23 AM
  4. Pick a number....
    By Salem in forum A Brief History of Cprogramming.com
    Replies: 39
    Last Post: 01-19-2003, 07:27 AM