Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Is this crap ?

Name: Anonymous 2009-12-03 16:15


// project created on 12/3/2009 at 8:23 PM
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

int main(int argc, char *argv[]) {
    FILE *f;
    char s[255];
    char *bogo = NULL;
    char tmp[9];
    unsigned int val = 0;
    unsigned int i = 0;
    unsigned int c = 0;
    f = fopen("/proc/cpuinfo", "rt");
    if (f == NULL) {
        printf("We are probably on iShit or WinShit\n");
    } else {
        while (!feof(f)) {
            fgets(s, LINE_MAX, f);
            bogo = strstr(s, "bogomips");
            if (bogo != NULL) {
                i = c = val = 0;
                while (bogo[i] != ':') i++;
                i += 2;
                while (bogo[i] != '.') {
                    tmp[c] = ' ';
                    tmp[c] = bogo[i];
                    bogo[i] = ' ';
                    c++;
                    i++;
                }
                val = atoi(tmp);
                printf("%i\n", val);
            }
        }
        fclose(f);
    }
    printf("Done\n");
    return 0;
}

Name: Anonymous 2009-12-03 16:26

We are probably on iShit or WinShit
This makes me angry. I scorn Windows, yes, but to resort to such lowly tricks? What are you, OP, 12? Just throw an error, and if you want to let off some steam, write a fucking essay.

Name: Anonymous 2009-12-03 16:32

the reason for this is to give OSX and Win people a taste of their own medicine
also, ill use bogomips to adjust my app's performance (game)

Name: Anonymous 2009-12-03 16:32

THE SCORNFUL ANUS

Name: Anonymous 2009-12-03 16:44

>>2
What are you, OP, 12?
That does appear to be the case

Name: Anonymous 2009-12-03 16:45

I didn't read the code, so yes.

Name: Anonymous 2009-12-03 17:04

Dumb.

if(a){
    die-with-an-error();
} else{
    /* wasted one indentation level */
    lines-of-code();
}


Compare to:

if(a){
    die-with-an-error();
}

lines-of-code();


I always prefer the latter.

And, yeah, I want to know what game is it that compiles on win/mac yet uses linux functionality (i.e. no syscalls at all, written in pure C) and needs to know performance of the computer.

Name: Anonymous 2009-12-03 17:06

Yes, it is crap.

also, ill use bogomips to adjust my app's performance (game)
1980 was 30 years ago! Give it up.

Name: Anonymous 2009-12-03 17:09

well what would you rather use than bogomips then?

Name: sage 2009-12-03 17:10

Yeah, the iShit / WinShit nonsense definitely makes it crap.  Grow-up or just go hang out on some obnoxious Linux-fanboy forum so you can be with your kind.

Name: Anonymous 2009-12-03 17:10

>>7
actually it doesnt die in case of an error
just assumes a default value (low) and keeps going

Name: Anonymous 2009-12-03 17:55

>>10
You're just too gay to admit that obsolete toy operating systems are inferior

In fact, you are so gay that you are actually homosexual

Name: Anonymous 2009-12-03 18:31

>>9
Since you're slow I'll spell it out for you: don't use a fucking timing loop.

Based on some of your antics you've obviously been born some time after video game timing loops have been made entirely unnecessary. I conclude that you are learning C from some ancient pedophile who needs to get with the times already.

Name: Anonymous 2009-12-03 19:15

actually mister i-know-it-all i have a perfectly good reason to want to use the bogomips value specifically. it would be obvious to anyone knowing the kernel but fine...

also i recommend you go back to C# or whatever it is faggots like you learn nowadays and brag they are ubercoders.

oh btw, i did release some games before, perhaps Minter rings a bell? oh sorry you are a new fag...

Name: Anonymous 2009-12-03 19:29

FUCK MY DICK

Name: Anonymous 2009-12-03 19:35

>>13
What is the thing to use these days to ensure that the game is running smoothly at a fixed rate (not just how many times you draw shit per second but how often the game state is updated -- unless updating the game state like that is wrong too)?

>>14
No it doesn't ring a bell, and the Googles tell me nothing.  Have you read your fanmail today?  Didn't think so!

Name: Anonymous 2009-12-03 19:42

Name: Anonymous 2009-12-03 20:07

>>14
ahem, knowing the kernel means knowing in detail why userland never needs to/shouldn't do anything based on bogomips. just to be extra clear: the value is even more meaningless to anything subject to the scheduler.

>>16
depends on what kind of precision you want and whether you want to sync with anything. the linux kernel is pretty good at giving you ~10ns timing precision on modern systems. if you want to sync, use an interrupt handler.

Name: Anonymous 2009-12-03 20:35

>printf("We are probably on iShit or WinShit\n");

This is why we program in Java

Name: Anonymous 2009-12-03 20:42

>>19
You can do this just fine in C, if you are not an idiot.

Name: Anonymous 2009-12-03 22:12

>>18
oh ok, I just thought meant "no timing loop" meant to not use time() or clock() or anything like that.  Would that work at a game running at like 60 FPS?  I think I need a book on the subject of game states / managing them at a constant rate.

Name: Anonymous 2009-12-03 23:25

>>21
Oh god, is that what you thought? A timing loop needlessly (in modern times) drives CPU use up to 100%. No fun. Going to sleep lets other things use the CPU and generally conserves power.

Look, I'll actually try to be a bit helpful for real: http://www.coranac.com/tonc/text/toc.htm

Read that. Skim through the bits that don't apply but make sure you understand the "why" of all that stuff. Some of it is wildly specific, but keep in mind that this is for a piece of hardware designed to run video game code. It's also minimal enough to give you a good idea of what is going on at the hardware level, and how people solve these problems without  commercial APIs to do most of the work for them.

Would that work at a game running at like 60 FPS?
Yeah, if you want to sync to framerate it's the easiest case to code for.

Assuming double-buffering, do something like this in a loop: flush & flip video buffers, update game state, write to the unused buffer, wait for vsync, repeat. Just about any SDL type library should have something for waiting for vsync etc.

Name: Anonymous 2009-12-04 9:26

>>3
OS X uses devfs - I think it's part of the Common UNIX.

Name: Anonymous 2009-12-04 10:04

>>23
Implying that OS X is Unix
( ≖‿≖)

Name: Anonymous 2009-12-04 10:20

Name: Anonymous 2009-12-04 12:37

ITT: /g/

Name: Anonymous 2009-12-04 16:38

>>22
ok, thanks.  I'm still look for books or other more advanced information on the subject of managing game state.

Name: Anonymous 2009-12-04 17:07

VSYNC MY ANUS

Name: Anonymous 2009-12-04 18:25

>>27
Yeah, of course you should also pick an API to use and see how people are working with that. There must be a lot of good examples for (say) SDL.

Name: Anonymous 2013-09-01 13:19


The modern study of set theory was initiated by Georg Cantor and Richard Dedekind in the 1870s. After the discovery of paradoxes in naive set theory, numerous axiom systems were proposed in the early twentieth century, of which the Zermelo–Fraenkel axioms, with the axiom of choice, are the best-known.

Name: Anonymous 2013-09-01 15:36


Cantorian set theory eventually became widespread, due to the utility of Cantorian concepts, such as one-to-one correspondence among sets, his proof that there are more real numbers than integers, and the "infinity of infinities" ("Cantor's paradise") resulting from the power set operation. This utility of set theory led to the article "Mengenlehre" contributed in 1898 by Arthur Schoenflies to Klein's encyclopedia.

Don't change these.
Name: Email:
Entire Thread Thread List