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

Useless code

Name: Anonymous 2008-11-20 4:06


bool useless(int32_t val, char *b, size_t bl, char **nl)
{
    uint32_t c,i,msk;
    bool ret;

    c = 0;
    msk = 1000000000;
    if (val == 0) {
        b[c++] = '0';
        ret = true;
    } else {
        if (val < 0) {
            b[c++] = '-';
            val *= -1;
        }
        while (get_cypher(val, msk) == 0 && msk > 0) {
            msk /= 10;
        }
        bl--;
        while (c < bl && msk > 0) {
            b[c++] = '0' + get_cypher(val, msk);
            msk /= 10;
        }
        ret = (msk == 0);
    }
    *nl = b + (c <= bl ? c : bl);
    *nl[0] = 0;
    return ret;
}

Name: Anonymous 2008-11-20 4:06


uint32_t get_cypher(uint32_t val, uint32_t order)
{
    return (val % (order*10))/order;
}

Name: Anonymous 2008-11-20 4:26

#include <stdio.h>

#define NUMBER 16777252.0

int main(){
 for(float i = NUMBER; i < NUMBER + 1; ++i) printf("%f\n", i);
 return 0;
}


does this program terminate?

Name: Anonymous 2008-11-20 4:38

>>3
No.

Name: Anonymous 2008-11-20 4:46

OP Speaking: complete demonstration code here, runs on a GNU/Linux (it should be mostly POSIX compliant).

http://pastebin.com/m73ebc43f

Seemingly useless, but the algorithm allows to build a simple sprintf-like function for integers, without having the whole stdlib

Name: Anonymous 2008-11-20 4:48

because snprintf is so bloated amirite? brb going to develop anonix.

Name: Anonymous 2008-11-20 5:01

>>6
...just think about embedded systems. A few kilobytes of memory available and an operating system without stdlib... what would you do? Go.

Name: Anonymous 2008-11-20 5:03

>>6
most of the time when people use snprintf, they really want to use asprintf instead... too bad it's not in the C standard, even though it is supported by just about every widely used libc.

Name: Anonymous 2008-11-20 5:09

>>8

Most of the time when people post into a thread in sage and talking about a non-stardard pieces of code, they really want to troll.

Enjoy your failure.

Name: Anonymous 2008-11-20 5:25

>>7
http://www.rtems.com/

>>9
s!to.*,! on [spoiler]/prog/[/spoiler],!

Name: Anonymous 2008-11-20 5:28

>>10
http://www.rtems.com/

They are still using CVS! What a lame.

Name: Anonymous 2008-11-20 5:30

>>11
at least it's not slow as fuck like that darcs and git and whatever else the kiddies are using these days.

Name: Anonymous 2008-11-20 5:34

>> 12
at least it's not slow as fuck like that darcs and git and whatever else the kiddies are using these days.

Such a jerk. DVCS are the future. You are old stuff, faggot.

Name: Anonymous 2008-11-20 5:39

>>7
You even said it's running on GNAA/Linux
Anyway, this task is trivial, bro. Even if you don't want to write this little procedure yourself, you'll just c/p it from libc's itoa. I'm not sure why you posted this code on our nice /prog/ board. bro.

Name: Anonymous 2008-11-20 5:55

>>13
what exactly is wrong with CVS?

Name: Anonymous 2008-11-20 6:53

>>15
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed
it's not distributed

GET IT?

Name: Anonymous 2008-11-20 8:42

>>16
if by "distributed" you mean slow as fuck because it downloads over 9000 old versions of the code, then yes. also, enjoy your merge conflicts.

Name: Anonymous 2008-11-20 9:54

>>17
IHIHBT

Name: Anonymous 2008-11-20 10:17

>>16
CVS is distributed under a Free GNU license and can be obtained quite readily. Proceed here for instructions on using UD6/CMtool and Uniface with CVS.

Name: Anonymous 2008-11-20 10:28

>>17
Clearly you don't know that GIT can also be employed as central repository. While everyone maintains their private copy, all changes are uploaded exclusively to the main hub, so in this respect it acts very similar to SVN while still providing a better overall source control experience to the programmer.

Name: Anonymous 2011-02-03 1:16

<

Name: Anonymous 2011-02-18 14:13

<-- check 'em

Name: Anonymous 2013-01-19 14:39

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

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