Jump to content

Avratz

Member
  • Posts

    163
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Avratz got a reaction from LukeTim in Best Software to Code Linux on?   
    http://www.linuxfromscratch.org/
  2. Like
    Avratz got a reaction from iWearKiltz in C: user defined strings and files   
    Escaping is only needed for string literals. User input doesn't need to. In your original example, you had the file paths hardcoded, and thus needed to escape them.
     
    The *_s functions are done that way, so the function can return a meaningful error value. It's safer in the sense that you are handed the error code directly rather than relying on a global error flag. See the section on return values here http://msdn.microsoft.com/en-us/library/z5hh6ee9.aspx
     
    For standard fopen you have to make a call to perror() or check the value of errno to get more information on the error. A NULL file handle isn't very meaningful beyond the fact it failed. Sometimes it's useful to know why.
     
    ex
     
     

     
     
    Microsoft version
     
     

  3. Like
    Avratz got a reaction from madknight3 in Help with C.   
    Golfing is fun. I should have prefaced my post with just because you can doesn't mean you always should.
     
    Conditional expressions are useful. Just don't abuse them like I did.
     
    I'd rather write printf("some message ... %s\n", str ? str : "<<null str>>"); than an if block though.
  4. Like
    Avratz reacted to smjpl in Help with C.   
    Here are some free ones. There are books for loads of languages so I just quoted the ones for C.
  5. Like
    Avratz got a reaction from levsingh in A conflict exists with definition in namespace internal   
    Straight from the Adobe docs
     
     
    http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7f9d.html
  6. Like
    Avratz got a reaction from GoodBytes in Here's a very basic console game I made...   
    You need to compile your project in release mode(select config from the dropdown box at the top). The D on the end of the DLL name signifies it's debug, so it won't be included in standard Windows C runtime libs.
     
    Furthermore, you can forego the use of a DLL by changing the runtime linking under project properties(right click project in the solution explorer and select properties). /MT for release, /MTd for debug. This will statically link the C runtime in your exe.
     

  7. Like
    Avratz got a reaction from harrynowl in LGA775 Core2Duo, Core2Quad OVERCLOCKING guide   
    My old core2duo e6550 was one of the easiest overclocks I ever did. I didn't really push it as far as I could though. Still have it in my closet.
     
    C2D E6550 2.33ghz x7 multiplier
    Gigabyte P35 DS3P rev 1.1 motherboard
    OCZ Reaper DDR2 800 2x1GB
    Tuniq Tower 120 cooler
     
    I bumped the ram to 1000 (3.5ghz OC, 1:1 ratio) and called it a day. Ran cool and stable for years. Can't say if I had to touch any voltages. I did later when I added two more reaper sticks, but it would only go a little over 3.3. Bad move on my part.
     
    Tuniq Tower is still in use on a Phenom II 955BE
  8. Like
    Avratz got a reaction from wolfsinner in [Problem Solving #6/7] Solving the N-Puzzle   
    Last solution was incapable of solving 15-puzzles due to horrible memory efficiency. Storing the entire visited tree is dumb and defeats the purpose of IDA*.
     
    New solution ditches trees and allocation altogether. Not only is memory performance infinitely better, it's faster too.
     
     
    Could use a better heuristic, but performance is satisfactory.
  9. Like
    Avratz got a reaction from Crabtr in The under 100 line challenge!   
    I ported my C FizzBuzz solution to an x86 bootloader. Right at 100 lines. Using 165 out of 512 bytes available.
     
    Currently working on a version that writes directly to the VGA controller instead of using the BIOS interrupt 10h.
     
    If you aren't familiar with FizzBuzz http://c2.com/cgi/wiki?FizzBuzzTest
     
     
    Nicely colored source http://pastebin.com/gkPzHFJN
     
     
    Running in the Bochs x86 emulator

  10. Like
    Avratz got a reaction from Ciccioo in Fizzbuzz   
    Check my sig
  11. Like
    Avratz got a reaction from cae in Looking to get a handgun for home defense... Best/most economic calibre?   
    Any lethal round will penetrate walls. If you can't penetrate drywall, it isn't going to be effective on a person.
  12. Like
    Avratz got a reaction from cae in Need a pistol under 500$ USD   
    Indeed, our laws are out of control.
     
    Too damn many of em.
  13. Like
    Avratz got a reaction from Jonathan=PC in Why spend money on mechanical keyboard with cherry switches? :)   
    Typing feel.
     
    Custom caps.
     
    Durability.
     
    Cooler Master keyboards are good and affordable. Can easily be had for under $100.
     
    First step is to find a store where you can test different switches and see which you like, or if it's worth it to you at all.
  14. Like
    Avratz got a reaction from Osmium in To anyone who has used G-Sync...   
    I have a 27" 1440p IPS panel sitting next to it. 
     
    Once I played a game at 144hz I never considered gaming on it again. That was before gsync. After I installed the kit all bets were off.
  15. Like
    Avratz got a reaction from Real_PhillBert in 9-Year-Old Girl Accidentally Kills Shooting Range Instructor   
    Er, no.
     
    You don't get a "license". You get a tax stamp saying you paid the tax for the privilege to own an NFA device.
     
    You are confusing a class 3 SOT(NFA dealer) with simple NFA ownership.
     
    Fingerprints, CLEO sign off, and photos are not required if you file under a corporation/trust. Many people are forced to do this because many CLEOs are dicks and won't sign. Some states (like TN) passed laws forcing CLEOs to sign.
     
     
    The rest is just nonsense. Drug tests, random searches, and storage requirements for having a tax stamp? Lol
  16. Like
    Avratz got a reaction from ShadowCaptain in Is it just me or?   
    If we're talking native resolution, 27" 1080p has pixel pitch the size of cats.
     
    27" 1080p: 0.3114mm
     
    24" 1080p: 0.2768mm
     
    27" 1440p: 0.231mm
     
     
    It's quite noticeable between my VG248QE and Auria 27" 1440p IPS. 27" would be like looking at my monitor through a screen door.
  17. Like
    Avratz got a reaction from mr.skyrim_pc in 9-Year-Old Girl Accidentally Kills Shooting Range Instructor   
    It appears she was firing a mini-uzi. 
     
    Smaller, lighter, and a higher rate of fire. 950RPM is no joke.
     
    He needed to be bracing and holding it with her, and definitely not have more than a few rounds in the magazine. 
     
    Everyone calls him an instructor, but it's not clear that he was even trained as one. The way he rushed her from single to FA I'd be inclined to think not.
  18. Like
    Avratz got a reaction from cae in 9-Year-Old Girl Accidentally Kills Shooting Range Instructor   
    Er, no.
     
    You don't get a "license". You get a tax stamp saying you paid the tax for the privilege to own an NFA device.
     
    You are confusing a class 3 SOT(NFA dealer) with simple NFA ownership.
     
    Fingerprints, CLEO sign off, and photos are not required if you file under a corporation/trust. Many people are forced to do this because many CLEOs are dicks and won't sign. Some states (like TN) passed laws forcing CLEOs to sign.
     
     
    The rest is just nonsense. Drug tests, random searches, and storage requirements for having a tax stamp? Lol
  19. Like
    Avratz got a reaction from as96 in [Unity] Increase performance (terrain generation)?   
    Make sure you are only rendering visible faces.
     
    How are you storing and traversing the blocks for rendering?
  20. Like
    Guest
    Avratz got a reaction from Guest in Gamecrate shares a feminist video, but I want to explore this   
    Feminists ruin everything they touch. I'd rather they stay as far away from gaming as possible.
     
  21. Like
    Avratz got a reaction from DigitalHermit in What Programming Language To Learn?   
    Lisp
  22. Like
    Avratz got a reaction from LukeTim in Bad, terrible or simply funny code examples   
    Any decent compiler will optimize that sort of stuff away.
     
    Let's look at what GCC does using -O3 optimizations:
     
     
    Turns into:
     
     
    The important lines are 6, 7, and 8.
     
    GCC recognizes & 0xFF, and the result of the rand() is truncated on line 6 using the movzx (mov and zero-extend) instruction taking the byte in bl and zero extending it back into ebx. Changing it to (unsigned char)j produces identical assembly.
     
    It also recognizes i is used nowhere else, and doesn't even bother storing 0xFEFE instead putting the cast-truncated value 0xFE on the stack (line 7).
     
    Then finally on line 8 it puts the full ebx register onto the stack since foo takes an integer. (The foo call is actually optimized away as well)
     
    No ANDs in sight 
     
    Notwithstanding the merits of simply truncating a color value.
  23. Like
    Avratz got a reaction from Sihastru in CM Storm QuickFire XT Stealth MX Green vs. FILCO   
    No, the Filco is not worth double. Costar makes both.
     
    I'm a programmer and I never use the numpad, so I appreciate the saved space on a TKL. I'm using a QFR with green switches and I love it. Previous keyboard had blacks which I also like. I didn't like blues at all.
     
    Only reason not to get greens is if you have girly hands and can't handle the 80g force.
  24. Like
    Avratz got a reaction from Ciccioo in Pop quiz: integer number representation in C   
    1) Because the conversion from float to int simply truncates the fractional part. If a = -1.5f the result is still the same. The conversion from signed to unsigned simply zero extends or truncates the signed value to fit the unsigned destination. 
     
    2) GCC doesn't warn me even with -Wall -Wextra Actually it does and I wasn't paying attention
     

  25. Like
    Avratz got a reaction from cae in What's the best way to solve a global population crisis?   
    The solution is to do nothing. Let people live freely, and it will work itself out one way or another.
×