• Welcome to Dark Bit Factory & Gravity.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - cybro

#1
Maybe you've already made up your mind, but just one thing worth mentioning:

Although you can use this like how printf() does, you can have it be NULL delimited too.

As in all on one line:

myfunc(ARG1, ARG2, ARG3, .... ARGn, NULL);

And inside myfunc:


#include <stdio.h>
#include <stdarg.h>
void myFunc(void *FirstObject, ...)
{
void* object=FirstObject;
va_list ap;
va_start(ap, FirstObject);
/*--get it started--*/
do
{
/*--do your thing with object--*/
printf("%s ",object);
object = va_arg(ap,void*);
} while(object!=NULL);
va_end(ap);
}

void myFunc2(unsigned firstNum, ...)
{
unsigned num=firstNum;
va_list ap;
va_start(ap, firstNum);
/*--get it started--*/
do
{
/*--do your thing with object--*/
printf("%d ",num);
num = va_arg(ap,unsigned);
} while(num!=0xDEADBEEF);
va_end(ap);
}

int main(int argc, char *argv[])
{
    myFunc("Hello, world!\n","what's up?","yoyoyo",NULL);
myFunc2(1,2,3,4,5,6,7,8,0xDEADBEEF);
    return 0;
}




In C++ there is probably someway to make a linked list class and overload operators so you can use << or + or something, so you could have a line like:

myfunc << arg1 << arg2 << arg3;

or myfunc + arg1 + arg2 + arg3;

But I don't know enough about C++ to know if that is true or what the pitfalls might be.
#2
I used icc because when you go /Qstd=c99 you have designated initializer lists but in msvc you cant because it didnt have them. But I was using a warez icc just to try it out and I have since gotten rid of all of that stuff.

But here is a good link if you will use icc, it includes info to customise the runtime libs so that it doesnt penalise AMD cpu users. You just define a function so it uses yours and not the built in one which checks for geniune intel. Check it out: http://www.agner.org/optimize/
or
http://www.agner.org/optimize/blog/read.php?i=49
#3
Hello, joined so that I could download tiny sid post attachment.

I'm looking into making something, maybe a small demo, with pelles c. Originally I was going to try and use dumb with the samples compressed with wavpack, but this takes too many kb.