Was about to ask with what flags should I compile Ive got -Wall will -pendantic and -ansi help or just get in

man 2 stat

hello, I am pretty new to c and I have some issues with a program. Here are the details: http://slexy.org/paste/4372. If someone could help me I would be very thankful

thanks

vorad, that’s not C. That’s C++
/join ##c++ please, vorad

I know, but on ##c++ they told me to come here
lol

many C++ programmers are quite stupid.

Well they’re fools, because that’s not C

heck, I know I shouldn’t use c++, I should have stick to pure c

so where did you get your programming skills?

if i’m trying to find the extension of a file, i use strrchr() to find the last occurance of ‘.’ but the problem is that this won’t work for files with a starting with a ‘.’ — for example: ‘.test’

are you talking to me?

is there a way to ignore this and treat ‘.test’ as a file with no extension?

any of you

anyhow, the problem is clear.
what is dadInitial declared as?

i’ve been trying to learn c or c++ for a while and always get frustraded with the lack of information
t

learning to read may help with that.

lol
yea im sure it would

you could test if the index is 0, in which case it starts with a ‘.’.

likewise you should learn how to spell simple words like “I’m”, and “yeah”.
s/random/Randy

thanks, I forgot about

ah, good idea — thanks

wrong.
you forgot to answer my question.

Randy, there’s plenty of information. There are tonnes of C books, millions of lines of C source available on the internet (although granted, not all of them are very good C), plenty of C tutorials (again, not all of them are very good)

np

as char is declared and it is used as string – I think I fixed that

sweet, works like a charm

.. as well as plenty of resources such as ##c on IRC

ok.

at best i can do pissy little adding programs
but whats the use in those

Not much, set yourself a larger project and do it

good advice

If you’re having extreme difficulty doing it, you’ve given yourself too complicated a project. If you’re finding it easy, you haven’t set yourself a complicated enough one..
Have a look at lists of open source projects for inspiration if you can’t think of anything to do, or even consider joining a simple open source project

whew.. #3 son is upstairs.. Geezus, my ears hurt

good deal

every “big program” is N lil’ programs looking to break out.

so do you use c or many different languages to complete a project

I live in C

##C is my new home…

I live in C and gforth (for wtf?)

what type of projects have you done?

BUT, be aware.. almost every issue folks raise is about GUI stuff. The interfaces between machines and people.
doesn’t matter what I’ve tossed out into the PD for decades – all that matters is I care. shrug

lol

I used to be able to point at tarballs – that drive croaked. Plus, it just doesn’t matter

115 updates for ubuntu

tell ubuntu

It’s almost never the func-interface (API) that gets bollixed. It’s almost always soft-input.

gui’s can easily get messy

whats the best host c api out there

I’m happy and I try to backup regular.

people decide they want to add a combo box, and all hell breaks loose

do you even understand “C” or “API”?

i agree with poppavic

from what i do understand

C java api hosting for what?

api is a subset in the languge that has precomiled headers and such you can use??????
its like an addon

and define ‘best’

what are ‘tarballs’?

for creating spreadsheets and what not

*.tar.gz

or *.tar.bz2

oh!

or *.tar

ok ok
I’ve understood

better *.tar*

It’s the problem of not have english as native language.

are most api’s free?

you have no idea what an API is/means

do you have a specific question?

so’k: also .bz and zip and whatnot.

application programming interface is about all i understand

how can I count all the lines in a text file

(we can see that)

simply put, an API is just a defined interface to a library

that’s at least 3 words. Do you understand them?

from what noirlord is saying its an easier way to access different precompiled libraries

fr[a]nkr: counting the newlines.

fr[a]nkr: int i = 0; while (c = getch however you want to); if (c == ‘\n’) i++;

no

no?

I am sorry, you are just wrong.

why?

not really easier, its just a defined interface to a library, defines what functions the library provides what datatypes it takes and returns and such

an API is where you “publish” an interface that folks shoud use and respect.

the actual implementation details “behind” the java api hosting are usually a blackbox (if your programming against the WinAPI they are always a blackbox)

right

i see, so its really just code words for the code itself

no

damn i suck

not all code is an api

fr[a]nkr. wc

Randy, say I create a library that allows you to draw graphics on screen, internally the library could have lots of functions the end user does not need, so I define an API for my library that has functions like DrawBox(), DrawTriangle(), the API is just the specification for how the end user
programmer “talks” to the library

“interface”

wc -l

_agreements_

if that library is then made cross platform the code for DrawBox on windows is going to look alot different to the code for DrawBox on linux however the end programmer just calls DrawBox and the library handles it

good explanation

brb s

anyone know the API for hot girlfriend?

void CallHotGirlfriend();

well, it helps – not ideal, beacuse most folks thing “programming” implies “to the machine” – whatever “machine” means

no return value

not like she’s going to return anything

that desperate? Yer a sad lil’ puppy

suspects the API for a hot girlfriend would take a pointer to your wallet

too many subjectives anyway

suspects the API for wife is simpler, bool AnyChanceOfAQuickie(){ return false; }

what is ‘programming’ to YOU?

noirlord, ptr to my wallet.. she looking for my cache?

it’s always a recipe to generate whatever slop you want.

zap, just check your pointers, passing a pointer to your pr0n collection would result in a call to Divorce(..)
zap, just check your pointers, passing a pointer to your pr0n collection would result in a call to Divorce(..)

every language is particular to “recipe building”, all results are exactly what you get from that recipe.
every language is particular to “recipe building”, all results are exactly what you get from that recipe.
don’t forget – I’ve #1 son (motorhead) and #3 son (welding/plumbing) and none can 100% agree with my sis that is a parent and cook.
yet, if you sit everyone down and make them write, you can get a “recipe”.

programming – the process of automating errors (forget where I stole that from)

must be from a newbie or scriptor

i see it as taking nature, and reducing it to an instant in time where there is only a 1 or a 0.

sorry had to measure some catfish

sorry, #2 son – not #1

“Beware of bugs in the above code; I have only proved it correct, not tried it.” (Knuth)
I wouldnt call Knuth a newbie

Knuth never much interested me, either

or an instant in time where there are 32 (or 64 or 16 or something else) 0’s and 1’s

Knuth is a genius.

hey thanks everyone i’m gonna go read some crap and try to catch up

myself_, but the amount of numbers is mostly irrelevant. wether something is or isnot is far more important.

used one of his algo’s in a program for uni last year (first year) (well its called the Knuth shuffle but sources all claim Fisher-Yates as the creator) elegant way to shuffle
an off course he created TeX (should be canonized for that alone)

it’s wrote in the first pages of TAOCP (vol.1)

the amount of numbers is important, think about random(); whether or not the numbers exist is far more important than what they are… 4000000^2 makes numbers of numbers important

myself_, look at how most people communicate, all the above for example… ‘most’ of it is simply defining a state.

he created TeX, but it wasn’t on 2 months, nor 2 years. MANY YEARS

TeX doesn’t thrill me shrug

but the length of a comment does make communication possible, what if someone posted a 6kb response to somthing, no one would read it

as LaTeX its pretty hard to beat for writing essays on software projects (just for the listings package alone)

I’ve never used TeX (yet)

what if someone posted a 1 byte response, who would understand it

you simply want another wrapper and presentation.

people communicate via prediction.

its much more than that, it handles typesetting, tables of contents, list of references and bibliographies automatically
its much more than that, it handles typesetting, tables of contents, list of references and bibliographies automatically

what if someone posted a 1 byte response, who would understand it. ‘I’.

yer doing it again

i hear some AI studier words…
or do people communicate via association?

necessarily via prediction.
think about it.

but i could communicate 1+1 to you, and you would know the definitive answer, where is the prediction there?

all of that shit is a LAYER – an interface – above the damned data of the payload. You can abstract all over, but at least admit it.

you are confused.
I can predict that if I say 2, then you’ll say “correct”.

PoppaVic anything above machine code is an abstraction and even then machine code is an abstraction

or something like that, but if you say “wrong”, then obviously my prediction failed, because I have misunderstood something.

the prediction is what a response would bring, what if i said 3, how would you respond?

umm… Even MC is “abstraction”

go and look up what abstraction means.

ok, maybe the + was overloaded to perform cat.

still, that means my prediction was wrong
but association is somthing i still have to stand by, even in this case, associating the ‘+’ character with a particular operation

association is only meaningful in terms of prediction.

Zhivago, do you write fortune cookies ?

you say “A and B occurred together, so I predict that they will continue to occur together.”

Zhivago – who butts heads with me far too often – has more years of RW experience with this stuff, and I assure you: everything is interpreted.

please be quiet if you have nothing intelligent to say.

true

what are we arguing about

nothing

arguing about agreements

if i opened a cracker and found one of PoppaVic’s gems instead of a joke, i think it would ruin christmas

and agreeing about arguing

Zhivago, but doesn’t prediction work through (or with) association?

Zhivago, are you saying only high intelligence is allowed to speak?

you may make predictions on many bases.

prediction is association

No idea what a ‘cracker’ or ‘gem’ in this context

depends on whose definition of highly intelligent we use

I am suggesting that you restrict the volume of stupid comments.

Randy, yes, I would say so too

no

or rather comes from

now i agree

nope

I think that it is only true to say “everything is interpreted” if you have reduced interpretation to something essentially meaningless.

prediction comes from association

“predication” simply means look-ahead based on “I am here” contexts.

not in all cases.

i agree

well, I am sorry – there is no “ultimate MC/ASM/OS/whatever”

prediction means that there is model.

but you predict something by association or other means

i should say association leads to prediction

“ultimate MC/ASM/OS/whatever” is meaningless gibberish.

yeppers

not necessarily.
so, your statement about there being none is likewise gibberish.
you can have association without prediction — it is called ‘observation’.

correct

i agree

Nope, I swept the decks of the gibberish – they can now clarify or not

with communication you have two systems which are attempting to positively predict one another.

but in order to have observation you have to use prediction

why?

no you dont

so you can associate whats really going on

Randy, you need association, not prediction

gibberish.

assoication and prediction can work independently

hello

hi

what is ‘42′
hi draichis_

ok i digress with my last 2 statements as being absurd
b

even worse: what is the diff between 0 and 1?

i rather like the sicp/scheme — it seems quite cool
hi PoppaVic, myself_
what dialect of lisp are you familiar with

one is there zero is not

no

mainly scheme and CL.

STARE at it

there are levels of abstraction beyond a certain level the degree of abstraction is meaningless (to that person), is it required to know that a 1 is an abstraction for a voltage above a certain threshold and a 0 is a voltage below that threshold, the term voltage is in itself an
abstraction

you need to be in a context to notice it.

different paterns

you appear to be misusing abstraction again.

ok, what is .0008 and .2 ?

and .9?

cool

different , might i – fractions

Zhivago, we are perhaps just using different contexts

someone, somewherem is interpreting shit. Period. Forever. I never said if it was voltage levels – analog or digital – or chars (what is that char?)

what you might say is that you can have an abstract view of volage on a wire as indicating 1 or 0 logically.

yeah, i also like the syntax — it’s also very simple to go through
i went through the commands.ss yesterday, i was rather impressed with the simplicity of scheme

a character
ohh

you cannot say that ‘1 is an abstraction for …’ — you may say that 1 represents indicates given volatage range.

I am more than happy to pass this to you.

aye, very homogenous

abstraction delegates the same yet in different forms

abstraction is about taking the interesting elements of a system — it is not synonymous with representation.

no.

no, it doesn’t.

what?

abstraction is necessarily a lossy process.

is behaviour of malloc(0) define?

Zhivago, it can also mean the act of removing something (in this case details or complexity that are not required)

if you’re not losing information, then no abstraction is possible.

i think NULL…

yes.

NULL?

the implementation may return a pointer to a zero lengthed region.

so why can’t 1 be an abstraction for a certain electrical property in a circuit?

- it’s jsut a translation that chip-techs and programmers NEED to be aware-of.

however, the implementation is also permitted to return NULL whenever it feels like.
because abstraction doesn’t work like that.
1 isn’t a model — it’s a symbol.

yer speaking of the “interpretation” ;-)

representation

you can say that the symbol 1 represents something.

oh.

but abstraction is about models.

hellooo
newbiee heree

so we can talk about a model with a wire with voltage on it, and then abstract that to a model with a logical value of 1 or 0 in a variable, etc.

need to ask a querry

sorry busy

*moves rapidly away from nacky*

well, I guarentee we will toast you

oops

removing the uninteresting details of electronics in the process.

i m scared man

perhaps next time you can be “comma using correctly man”.

just in here to ask a question

then ask
die well

ok
i want to write a C program using windows.h for blockin access of USB DRIVES and CD DRIVES

so 1+1 is an abstraction of the electronic process underneath?

huh ?

heh

I don’t think so.

honestly, e-techs think analog. It’s not until they get _above_ it that it is digital.

its like i was thing to make mah lab system a bit secure frm external viruses …

hmm, perhaps we are using different meanings for the word abstraction, I will look into it at somepoint I may be wrong (from past observation I would predict I probably am)

you might say “X = A or B” is a logical abstraction of an OR gate, perhaps.

sure

ny1… fr help ?
?

what other means of abstraction does scheme make use of, other than define?

nacky, there is no need to write a C program to block access to USB drives and CD Drives, you can set permissions on those devices such that a user without the required permissions cant use them

what language do you speak?

yeah. what about 1*1? because underneath it may just be a shift

noirlord, “to abstract” means “to take away”.

ny1? fr? mah? frm?

and analog folks will view the “interface” different than “digital”

but i have to show documentation , some program for gettin it accepted in mah lab

then again, I think that is again representation

this sounds like homework: die well

please use my “mah” is just irritating

write a shell script that runs chown and chmod

dey need a program , and i even belive in writting one … is dere ny way out in C to write a program to disable it

so document the process of how you set permissions on those devices

i want to take it as mah weekend project

is it a problem for it not to take all weekend?

no idea bout chown n chmod

ma nanho doolah bomahay, sure.

erm, you have let, where you can define temporary functions, and letrec where you can define temporary functions that can be recursive, and of course macros

Why is my connection dropping again? I thought I sorted this out earlier in the week..

abstraction means reducing

can’nt understnd ur words brother

ah — right

simplifying, agreements, etc

frns i read a virus program written in C , it had used windows.h and had place an .exe in registry startup

using LET and LETREC to define functions is useful because you can have two parts of your code that do the same thing but for some reason cannot be combined into one, so you put that code into a temporary function and call that instead

really? I was trying to speak “moron language” to make you feel more comfortable.
I guess I just can’t get the hang of it, though.

thnx alot frn

yer on a roll ;-)

fern?

so helpful

shu loa bshhaa, bubba

morons have a language? and me thinking it was just grunts and drool!

pretty much happens _all the time_ in C

maybe that would explain Zhivago’s problem

yes, morons speak even lower than Marines ;-)

rite nw i m feeling like a moron in dis room full of geeks

you also have the option of local defines.

yeah..

help p… …

nacky, try at least attempting to not murder the English language

can you translate that from moron to English?

ny knwldge bout windows.h

exactlly papa vic

indeed. although I’m not _sure_ if the local defines are defined _once_ or _every time_ the function is ran?

what kind of lab IS this?

uh, what?

This really isn’t an intelligent question.

nothin a junior section computer lab … dats it

write out your full words no more ‘ny’ try any noe more knwldge try knowledge

its like taking an apple and calling it a fruit

no more ’bout’ try about

they’re part of the lexical construction.

few kids brings dere flash drivess and every nw n thn systems crashes ..

I seem to recall that windows.h pulls in a bunch of win32-related headers…

I don’t understand what it would mean for them to be defined when the function is run.

As I don’t speak Lisp, Z and I don’t always agree; As I was never a Marine, (or blind) I never learned to speak Marine.

Called, perhaps?

since I have reasonable keyboard skills and can write English I actually find it harder to use “l33t” speak since it just feels wrong (not that I’m inclined towards using it anyway)

I thought they were but someone in #scheme thought otherwise so I was questioning it. d’oh

dats was mah question … if it wuld b intellignt enough i wont had ask it out hereee

well, it still doesn’t make sense to me.

disabling the use of storage media is probably the wrong solution…

can you translate that to English?

lesson learned, read the spec instead of trusting speculation.

Don’t type like a douchebag

what is Lisp

hmm, are you referring to lexical closure?

omg – yer ass is mowed

lol

If you have something intelligent to say/ask, then say/ask in an intelligent manner.

www.slackware.com should help you in the removal of viruses from your lab systems

a family of languages.

watch out ur words big brother
Ok

your crazy moon language is confusing us earth humans.

Christ, another dolt

heh

if you want to get rid of viruses, why not antivirus software?

thnx fr da help but i dont want to remove da viruses every nw n thn … i want to stop da root of viruses

I thought that language came from AOL, not the moon…

welcome to another day and ignore ;-)

dont read it

well, I’m not sure where AOL came from.

‘nw n thn’ WHAT???????

yes sir its an alternative

(define (foo) (define (bar) ‘hello) ‘blah)) ; I was told that bar would be defined every time the function was ran, although it didn’t make sense to me because I thought bar would be defined when foo is defined, not _every call of foo_

‘da’

perhaps it all originates on Yuggoth.

no it’s not

Lisp is an influential language from the early days , outside of psychotics, academics and emacs users (the only difference been the emacs users get more drugs) you do not see it used much any more

well, I am sure AOL predates the “text-messaging” crap, but here in ##C – they might as well be the same.

well, I still don’t know what it would mean to be defined every time.

bt sir if i write a C program fr disable pen drive and CD drive and giving acces to dese deivces to only administrator that would b much better

hey we have something in common i dont speak Lisp either

that the DEFINE is evaluated

i had this thing in mind to use windows.h

so why don’t you want students to bring any data in and out of the lab?

hmm, no, it doesn’t work like that.

if you spoke in full words that would be even better

I didn’t think so, I thought it queer that someone said it did

the rationale is probably not bringing virii in

well, I can speak Forth – so, most Lisp stuff seems similar to my C and Forths

though locking people out would be the incorrect solution

suspects it would be possible to write a C program that calls the relevant Win32 API’s to set permissions on devices..as to why you would bother when the program to do that is bundled in with windows is a mystery

why can’t you be a resonable person and just install avg or norton

no sir i m not restrictin ny students frm bringin in n out DATA . It is just all authority must b in hands of administrator
Ok

particulary since programming against the Win32 api hosting is slightly less fun than blending your testicles

they may not understand that there are two quite different semantics for define, depending on if it is local or top-level

yes, you are

it is often considered a blemish on the design.

so you understand my apples theory

You wouldn’t mind if I gathered other sources for feck to go over, would you?
Type properly.. really.

your restricting your students period

a blemish? why so?

Sir AVG , norton and all dese things are used by every1 (even lame)

it falls on yer head – simple.

I think the term is “control freak”

but how are you supposed to move data without a disk?

myself_, he is restricting his students period, need to set the lesbian alliance on him

If soultion lies in code then why not write one for it

because it’s ugly for one thing to have two very different meanings, just because it happens to be somewhere else — at least in scheme-land.

why not?

Ok

not at all

brilliant

Zhivago, it happens in C++ land with operator overloading as well

the solution does not lie in the code, it lies in the local phycoanalyisis clinic

well, isn’t that the same as (define foo (lambda (x) x)) and (define (foo x) x) ?

what C compiler do you people use?

for what you paid, you got yer $1 worth

Sir in actuall USB n CD are not allow in labs , it is like dat few students do it unofficialy and for fun dey crash lab systems
uSir in actuall USB n CD are not allow in labs , it is like dat few students do it unofficialy and for fun dey crash lab systems/u

yes, but C++ people are generally considered to be mildly retarded when it comes to language design.

yea i guess so

define has different meanings in both instances

no, that’s just a trivial syntactic difference.

Randy_, gcc (GCC (GNU compile Collection))

although I admit it is just a bit of syntactic sugar

i would too if you didn’t let me bring a cd into your ‘holy lab’

yeah

may b i m talkin to wrong person , thnx fr ur advice . You may carry on wid ur work ( i had just finished up mah talk wid anouther lame )

a local define is like letrec, iirc.

anouther

WHAT KIND OF CRAZY LAB IS THIS?

???

no more words mr. Genius

we haven’t had any from you to begin with

bo bo, mah wohoh! zoomble teh fublmeis, maun.

Zhivago_, they are mildly retarded when it comes to language design and yet C++ is a (near) superset of C

OK, I might as well prep dinner – y’all stay well.. Beat the kiddies ;-)

its not a krazy lab sir its just a govt property and everytime a system is down it need time … we peeps dont have time

you say data may be moved but you also say that the means to do it are not permitted?

well, that’s a pretty retarded starting point for a language.

Heh, I just find it interesting to play with.

maybe if you installed an anti-virus software your system wouldn’t go down so much…

you all peeps had great solution of Anti viruses but dey are not helpful everytime

myself_, if he installed slackware his systems would go down barely at all

dere are antivirus but sir still system goes down … heard of BRONTOX , GODZILLA , FIREFREE , MITALI

if he just disconnected the usb-ports and removed the cd-drives.

yeah. I do think that local defines are quite visually messy, or can be. especially if you follow a rule like “only define the function where it can be used”

Are you unable to use proper english?

it really does take the fun out of computing when you dont have to spend hours per week running antivirus scans, antispyware scans, downloading massive patches and update firewall definitions

man why u gettin on mah nerves … do your work .

If you require anti-viral software applications; I’m certain that this wouldn’t really be the best place for it.
Why is that?

why not hire armed guards for each terminal with 6 cameras

No

I was been facetious

I was just trying to make you feel more comfortable with your mental handicap.

i even know that

feck’s source is in feckbot/ and the IRC library I wrote which it uses is in scm-irc/ — http://monkeyboy.td.org.uit.no/~cin/

to let you know that it’s possible for others to lower themselves, temporarily, to your level.

so nice of u

In here, you never can tell.

indeed.

happy … now please get off mah way

do you follow such a rule or do you make some functions top-level for visual clarity?

draichis_, perhaps an XML scheme facetioussomepost/facetious

quit saying ‘mah’

or should I say, “enduide”?

please speak english.

my is even less characters

i think i am …

your going out of your way to use incorrect english

oh i see

well, I generally don’t make operators unless I intend to use them more than once.

well thnx for advice. I will surely follow it

but otherwise, sure.

I feel like I vomiting when people like nacky use words improperly

sure to the former?

I feel like laughing when people like drachis speak those words

do you have an excuse for this problem?

Pitty on u drachis

draichis_, I’m the first to admit that my written English is not what it could be however I agree with your sentiment

were you dropped on your head as a child?

draichis

i feal like laughing when people like nacky come in here
s/feal/feel/

hey man back off your limitss

I do not have a “limitss”.

I feel like vomiting.

and if I did, then I would not back off it.

draichis_, quite often I hold off on laughing at people for their standard of English there is always the chance they could be writing English as a second language

I’d rather watch people use digits in place of letters than watch nacky type.

further, I wouldn’t allow a “hey man” to do so, either.

myself :i feel like pity

then I just feel bad since I speak no foreign languages

then watch
I think my problem is beyond you all fake – subnormal peopless
i must find some other room
LAMES

please

please learn how to spell “people”, and do not shout.

boring

hurrah.

That’s no excuse to use wording stupidly.
They must have a native language, which has some sort of rule governing it

ah, sweet silence

ah the classic approach, “ask stupid and meaningless question” “act surprised when stupid and meaningless question is pointed out” “insult channel users for not been able to answer stupid and meaningless question”

There’s not much to learn — it’s a matter of being ruthlessly stupid

there is a god

I guess in scheme I tend to use named let for many of those cases.

draichis_, perhaps but the rules governing sentence composition and such are different for many languages and that can get carried across to another language

but whatabout the making up of words?

Yes, I’m certain of that, merely watching some people in here confirms this.

however if I ever did decide to learn a foreign language Id be careful to learn its constructs properly

I’d.

and if i did learn another language, and someone corrected me, i’d listen

Auris-: haha
Auris-: sup?

*circles around to his early post admitting his written English is not what it could be*

or, at least, not be intentionally incorrect.

Auris-: I like how you added a period to that message as if it was a sentence

Being intentionally correct is far worse than being stupid

incorrect?

Cin, and a very meaningful sentence it would be.

That too..

in the context of IRC or similar services there are far worse sins than dropping the “‘” from contractions I think

Auris-: hehe

yes, such as dropping a comma.

and making up words

I should work on my math someday, I’ve become pretty poor at math

work on it today

aspires to pretty poor at math

hopefully you will fail at that, too

That would defeat the purpose of wishful thinking

no, because then you wish for somthing else

by Japanese education standards my mathematical skills are pathetic but by English standards Im probably in the top percentile

I wish for only one thing which is subdivided into many.

which speaks volumes about the quality of the eductation you get here

well, perhaps quartile.

I’m
noirlord from programmers in yahoo?

Zhivago_, according to (british) government figures around one third of 16 year olds leaving high school are functionally illiterate (defined as the ability to read and comprehend a newspaper article) and can not balance a cheque book
draichis_, do you mean do I use this name in Programming:1 on Yahoo?

yes, which is why I could believe ‘quartile’, but not ‘percentile’.

nevermind

assume that mathematical ability has a roughly normal distribution — even if it is significantly substandard, it is unlikely to be possible to be in the top percentile by English standards and still considered pathetic by Japanese standards.

Zhivago_ would depend on the sample, if its aged 18-35 then perhaps percentile if its 50-75 then no way, people that age went through an educational system that was actually effective
Zhivago_, yes but your are equating ability with knowledge

No manual entry for woman

off too.

wasnt there once a manpage for woman?

man apostrophe
try that

i’m mathematically challenged but i can balance a checkbook

not found

yipee

the top percentile means the best one in a hundred.

Is there a libraray or program that will take a short text file and covnert it into an image?

Zhivago_, yes Im aware of that
Zhivago_ and I would bet in a random selected sample of 100 people across the whole population that I would be in the top percentile

probably, try google

Zhivago_, which as I said says alot more about the educational system here than it does about my ability (or lack thereof)

I think that it says that you may be accurate in your self-assessment

is this wrong?

that being, that your mathematical skills are defective.

while(foo) {
sleep(1);
foo–;
}

heheheh
Z’

what? sleep(foo); try that

The Cure for the Zhivago

is there a reason why the sleep wouldn’t work in the loop?

no

i didnt think so

what’s wrong with sleep(foo)?

i want to “do something” in the loop

Zhivago_ I know that my mathetmatical skills are poor but they are adequate for the things I need to do and where they are not I learn however compared to my contemporaries they are better
Zhivago_, when it takes three attempts to explain to your friends why a 14″ pizza at 4.99 is better value than a 12″ at 3.99 you start to wonder just how good the schools are

punctuation exists for a reason.

hehe, was clearing my pin prematurely

i don’t know what that means…

why are you learning how to code?

Zhivago_, they just couldnt get there head around it, “but you only get 2″ extra for a whole pound”

im working with parapin right now
makin a plotter

great

yeah it fun to learn this shit

if that’s the case, then i as well am in the top percentile

gonna use the PIC next

PIC microcontroller?

need to make an interpreter to create cheesy pbasic code to upload to the PIC
yep

what’s the biggest project you’ve done, thus far?

I work for an office supplies company (for the money while I’m at university) and the guy who runs our copy center couldnt work out how to working out the percentage scalings for an odd size photo to fit an A4 sheet

good luck…
everyone’s met idiots
but being better at math than them means nothing compared to this ‘top percentile’ talk

myself_, he is not an idiot, actually a fairly intelligent guy and once I explained it to him he saw it straight away my point wasnt that people here dont have the ability just that the education system doesnt allow people to express it

why not just code in c and put that on the PIC

i wrote a program called popdot that did web-based email ala smtp
and pop

you say that while i’m sitting in a dorm room

and you’re having such a hard time figuring out sleep() ?

does the pic have includes?

Grand.

the UK is strange, we have some of the best universities in the western world but the high school system that feeds them is failing badly

it was a parapin thing

of course we took the simple approach which is dumb down the degree level material rather than improve the high school level of education

there are compilers written for the pic and compilers written for all sorts of embedded systems

yep, not elite like you
lets see what i was using….
bside and bstamp is what i have

you’ll obviously want to staticly link everything for the pic
you should be able to download a c compiler for the pic

im cool, i got if figured out
cool
that is a good thing to know

Meh..

would have chosen an AVR over a PIC

whatever, i’ll make sure to stay -well- away from the kb

mostly becuase then I could use GCC and its a newer (saner) architecture

there aint no stopping this machine!
can any of the c compilers for the bstamp do fork?
i was actually thinking about using gumsticks
a pc104 would be cool too
but expensive

PC104 is cool in some ways (availability of tools becuase its based on an x86 architecture)

this is just an amateur thing though so i can get coding and get the prototype done

of course the downside is you have to program against the x86 architecture but you can not win them all

i was amazed at the speed and accuracy of the pic
you can really set a fine tuned pwm compared to using parallel, etc

the_plumber, if you come from a PC programming background I would imagine it would be a surprise how much you can do with a few million MIPS

4MHZ pic heh. i like that (in a form factor of 3mm)

of course the computer that put the Apollo Lander on the moon had an effective clock of 0.5Mhz

yeah, you dont need much

spark@failure:~$ man -k SIZE_MAX
nothing appropriate.

im thinking of trying to create the magic sinewave for power generation

man pages are useless

Spark SIZE_MAX is the biggest value a size_t can get afaik

where’s it defined
limits.h?

let me see

(i already know the answer is no)

same place as all the other _MAX macros, limits.h

you could just grep that

SIZE_MAX was not declared in this scope

Spark try stdint.h

include sys/types.h first

thinks having flexible sizes for integer types was a mistake

oh my bad, it’s stdint.h

understand the reasons why but I still think it was a mistake

Draconx yeah i though that too but you’re usually correct so .. yaeh :P

is that c99

yes.

does that mean there is no SIZE_MAX in c89

correct.

wouldn’t it be very rare for size_t to be anything else than unsigned int?

UINT_MAX it is then
ULONG, rather

no, UINT_MAX
is there some preprocessor statement i can have to check for c99 compability?
#ifdef c99_compatible, something like that?

good ques.

C99_SOURCE possibly

#if __STDC_VERSION__ == 19901L

19901 ? why that number

1990-1

oh

that’s my guess @ least

http://predef.sourceforge.net/prestd.html

what is that?

995. The intention is that this will remain an integer constant of type long int that is increased with each revision of this International
so I guess = is better than ==.

project to document the various macro’s and defintions used by a host of compilers

i see
so

nifty

#if __STDC_VERSION__ = 19901L #define SIZET_MAX SIZE_MAX #else #define SIZET_MAX UINT_MAX #endif
with indentation obviously

there’s a SIZET_MAX too?
ah i see sorry
it’s your invention

lol

yeah, though its not a good name

could have just done away with the whole problem by having a fixed size for int and working from there
which is what most languages do
or at least alot of them

what about #ifndef
or is it not always a macro

noirlord, most languages don’t have implementations on the host of devices that C does.

Draconx_, indeed however the size of an int would not have any impact on portability since that can be handled by the compiler

but it would affect the speed especially running on embedded systems
and increasing the width of the int could be done with a struct my_int or some such…

myself_, not really, if you need a 32 bit unsigned int then you need an unsigned 32bit int, if your not running on a 32bit system your gonna take the hit either way

noirlord, let’s say we define int to always be 32-bit twos’ complement. Now we try to implement this on a system with 9 bit bytes.

i disagree, because you don’t always need a 32-bit int

Draconx_, show me an architecture thats in use that uses 9 bit bytes

with ones’ complement arithmetic operations.

myself_ and the other datatypes still exist

noirlord if you want fixed sizes you can use (u)intN_t

noirlord, it was very common when C was developed, and common in microcontrollers today.

but i can show you some architecture where int is still 16bit

and 8 bit

noirlord www.36bit.com

noirlord, serial lines often use 10 bit bytes.

those edge cases could be worked around I still think it was a bad idea to have the size of an int be determined by the architecture it was been run on
the aim of a language among other things should be to reduce the number of errors and I wonder how many errors have occured becuase of integer wrap around becuase the programmer never took into consideration that an int can vary in size

and i still disagree

then we agree to disagree

noirlord thats the programmers mistake, plus if you dont want to worry about that kind of stuff use another languae
there are a plenty out there

if an error consistently occurs becuase of a feature of a given language then I view that as a failure on the part of the language not the programmer and yes there are plenty of languages other than C and in part its becuase of features like that

plus, you dont _have_ to worry about them, you can for instance code only for 32+64 bit windows, using the winAPI and c99

noirlord, yes, C is a terrible language.

computers are terrible

noirlord, however, I disagree that it is because of the integer types.

Draconx_, all languages are to a degree
I look at this way languages are designed to solve particular programs so as long as they do that they are good, Im not sure that C is a good choice for general applications development but for some things its hard to beat
but then that goes for most languages, Java has some really nice features but the move towards using it in embedded systems causes problems (it wasnt designed for that, guaranteeing real time time constraints when you have no control over when the GC runs can cause problems)

and, without support from rt, you can not access all the nifty HW features in Java, also no unsigned datatypes…

kessel3, yup

and, of course(!), the runtime has to fit in the memory RAM and ROM

the killer is the fact you have little control over the internal state of the VM though, the VM deciding to run the GC right at the point where you *have* to handle something in a given time is bad

then don’t use java web hosting for drivers

the EC++ consortium amuses me, they are so determined to shoehorn C++ into a domain where C exists that they’ve ripped so much out of the standard they are left with C with Classes

EC++ ?

hmm, yes, its funny
embedded C++

templates..who needs them, multiple-inheritance..no one uses it, RTTI..nope, namespaces hah! for fools, exceptions..not here

hehe i lke you :P

which is more funny considering c with structs and function pointers are more interesting and fun than classes

a new standard is coming out for C++ eh

myself_, the EC++ is busy inventing Object-C basically

another one?

they need to have a word with Apple

namespaces don’t even need any support from an RTS :-(

maybe we can talk c++ to death

templates really don’t either do they?

SamB, logic seems to be to drop anything that results in increased compiler complexity since its then harder to validate the compiler

myself_ yes
c++ 2009

which is required for it to meet legislative requirements for the type of systems its going to be utilised in
SamB, they should just leave C++ the hell alone and use Ada

templates can generate a lot of code

true

ada?

kessel3, they can and you then have to validate that code as well

american diabetes association

myself_, Ada was a language created by the government (well the military-industrial complex) to reduce the number of languages used the DoD

who uses ada?
i know…

myself_, its actually an excellent language for its market

extremely type-sensitive

myself_, avionics, automakers, military systems

no “warning casting from unsigned to signed” crap, its “error…”

hi all, I was contacted by a recruiter for a job that involves C/C++ programming, and I told him that I hadn’t used either for over 7 years (since university). He told me he thought it would be find (its more of a consulatant position with minimal coding needed aparently) but the client has a
programming test they wanted me to complete. I’ve finished it, and *think* I’ve got a reasonable solution, but was hoping I cou

ld post the problems (2) and my solutions and get any feedback (I wouldn’t want to look bad if my c code looks too babyish ;-) Is this ok? (I’ll paste it to rafb.net if yes)

well, we use currently rather C or little C++

kessel3, yeah C still dominates Ada completely in terms of the number of systems its used on
however for some systems Ada is basically *required* to meet the criteria

in automotive driver assistance, safety and chassis, powertrain

JohnCC go ahead

yep, avionics systems use it extensively

thanks!
http://rafb.net/p/rUJc8428.html
http://rafb.net/p/drWznd99.html

used to know someone who programmed in Ada for a living, he was a little strange
wrote the software to control the gimbals for a satellite tracking system or something…

sorry JohnCC can you paste all links in one line

smart guy but very odd (strange how often that combination occurs)

i hit ctrl+w accidentally heh.

http://rafb.net/p/YonYQn40.html
sure thing

has never used the C/C++ language, Ive used C or C++ however

http://rafb.net/p/rUJc8428.html (problems) http://rafb.net/p/drWznd99.html (arraySearch sol’n) http://rafb.net/p/YonYQn40.html (string compare sol’n)

lim(C/C++) as C-inf

JohnCC do you want me to rewrite them?
and then paste them and give you link?

C/C++ is UB isn’t it?
ah no, it’s 1

JohnCC, implement the KMP algorithmn

no, it’s UB

Spark, it’s UB.

you don’t have to do that (I’d feel guilty if I was submitting someone else’s solution), but if that’s the easiest way to critique it, I’d certainly look at your solution and compare it to mine…
will google that, thanks!

JohnCC okay then give me 5 mins

JohnCC you can start in the middle and keep chopping it in half
exploiting the fact that it is sorted, and you have random access

unless they stand over your shoulder while you do it how can they ever be sure that you didnt use someone elses solution

as long as they can continue using other peoples solution for the job it doesn’t matter

thinks that asking these sort of questions is a bit arbitrary anyway, been able to write a strcmp function doesnt imply that you can write good code overall
Spark_, you mean a binary chop?

yes

UB=Universal Binary ?

I probably *should* do that, since part of the problem is an “efficient” solution (“the function should be optimized for speed”). I’m worried about over-selling my c programming skills though (if they pulled out a whiteboard at a later interview I’d be sunk ;-)

!ub mc__

ub is undefined behavior. Invoking undefined behavior can cause demons to fly out from your nose.

binary chop is O(log n) iirc where your method is O(n)

lol candide rox

that’s just general programming knowledge

though a linear search can actually be faster in cases where list size is very small

algorithms, that is

you’re right

you can know one and not another, that’s normal

linear search is O(n) iirc with average case been N/2

I’m always worried about getting hired for a job I don’t have the skills to deliver on… it hasn’t really happened to me before (in working over 7 years in the field), but its still a fear for some reason

been a while since I read up on this stuff though
JohnCC, if everyone worried about been over qualified we’d all go work for Microsoft

grin

yeah linear = O(n)

is my solution for the right trim reasonable?

in the worst case yep

O(n) = O(n/2)
scalar multiples don’t make any difference, it’s just a measure of how the number of ops reacts to scaling the input

yep, average case is n/2 worse case is n if the item is the last element or not in the list and best case is that the item is the first in the list

just like O(1) = O(100000)

no, in case there is ‘ ‘ in the middle

but if the constant factor is 3 days, it still sucks :P

kessel, it says ignoring *trailing* whitespace

JohnCC in your rtrim you do not remove whitespaces only.

“example test”

yeah, but consider “my cat is angry “

kessel, looking at the brief, it says only trailing spaces are to be ignored therefore __big__dog__ and __big_dog__ are seen as different
lol@constraints “you may not use a regular expression library”

‘ ‘)

guess someone did once

” test hello” or to remove all teh whitespaces at the start and end of the string?

hmm, good question
I do love an unclear brief, it prepares you for when you get the job

haha

trailing whitespace is IMHO whitespace at the very end, not in between or leading whitespace

only end? or start too?

kessel, yes, trailing could imply only whitespace at the end or they could mean at both ends Ive seen trailing used in place of leading before

just putchar the stuff you want to be visable

lol solution

ghefd_

its not my problem mindshift

hehe, this is maybe a test also in requirements engineering :o )

you don’t have to remove anything, just putchar the stuff you want

wonders if he can be bothered to write a binary chop for problem 1

ok

i personally would go to the end of the string, then go backwards, until no trailing whitespace and return this position +1 as n to the caller. then compare from [0..n)

kessel3, after you have pointed it out I probably would as well, its not clear..for bonus points Id write both functions
then you are covered either way and it shows you can read a spec
seems a bit trivial though, I guess this is just a test to weed out the people who have said "yeah I know C" and are lying completely

i dont believe in bonus points, i had similar task, and i think the company just wanted to have an solution instead of hiring me

kessel3, what I mean by trivial is that you can set these problems to basically any programmer in a language they *dont* know and if you gave them a day the could solve them
it really doesnt test for any ability in the language they are testing for ability in
of course if they stuck all the candidates in a room with a computer and a compiler and no internet access and gave them an hour to do it then it would be marginally more useful

I thought of that, and it actually *IS* ok if there's whitespace in the middle rtrim("anvil anvil ") produced "anvil anvil"

ping

kessel3, also it doesnt specify how big the input is for problem one, for very large arrays then a hash would be better still

hmm, is my connection lagging or is it just quiet? strange, sometimes i get half a page at once to display

definetly an excercise in engineering requirements

what's the best way for testing for whitespace?

seems fine on my end
of course for a really large list you could use an interpolation search as well

i think i wrote it
http://rafb.net/p/UxzO1H17.html

would probably go for the binary chop though since the worst case for a interpolation search can really bite you in the ass

if i use a wildcard as one of the arguments in my program, is there a way to list all the matches? for example: "./app *.png" should list: pic1.png, pic2.png, pic3.png, etc

char buffer[] = ” “; – function will return NULL. char *buffer = NULL; – function will return NULL char buffer[] = ” hello “; – returns buffer + 2; with buffer+8 = 0;

Piratero, man fnmatch

Piratero_, there are plenty of RegExp libraries around that are open source (GPL or BSD take your pick)

noirlord, why do you put an underscore in each nickname

thanks

ghefd, muscle memory typo, some users have it at the end of their name and if Ive been talking to them recently…

http://rafb.net/p/UxzO1H17.html
hehe i see

ghefd, same reason whenever I type “low” I generally have to go back and remove the following 3 characters since my surname starts low

thanks! Looking at it now

no problem, and in your strspcmp, you could just call rtrim and strcmp
strspcmp(const char *s1, const char *s2) { return strcmp(rtrim(s1), rtrim(s2)); }
(but that would manipulate them)

“Binary search is one of the trickiest “simple” algorithms to program correctly. A study has shown that an astounding 90 percent of professional programmers fail to code a binary search correctly after a whole hour of working on it, and another study shows that accurate code for it is only
found in five out of twenty textbooks.”

lol, ouch

ghefd_, be sure to store the real beginning of the string if it is allocated with malloc

what is wrong with the typical binary search code?

maw, i though i could just use memmove()

of course if the programmer is coding it from scratch he should be slapped up the side of the head since there are generally libaries that do have correct implementations and Id want to know why he wasnt using one of those

maw, so i dont return some other pointer to get an error with free()

yeah

I wrote binary search in Haskell and I’m pretty sure it took a lot less than an hour…

Haha.

truth be told I’m struggling with pointers and values :-) All the java programming I’ve done has rotted my brain :-)

ghefd_, and I see no reason why you should run strlen in that loop

maw to go to the end of the string and then go back until *p != ‘ ‘

i think you missed to set str to p, in case you trim leading whitespace

SamB, would probably take me less than an hour, we did this stuff last year at uni then I promptly forgot all off it, it was filed in the “look up on google if I ever need to do it” category

str)

er, disregard that ), anyway i think that’s better
or not, not needed actually

the only reason I even had to bother was that I was implementing an arcane VM…

How come dev-c++ compiles multi-file projects just fine, despite implicit function declaration warnings?

which more or less requires it (you could do linear search I guess but that would be slow…)

there’s some problem with the rtrim you wrote…

JohnCC what problems?

It’s not properly trimming “anvil ” (returns “anvil “)

Zeiris, because the functions are declared implicitly.

JohnCC oh snap, wait

also some luck may be involved.

so when the compile host sees me calling a new function, it interprets that call as a declaration?

is it the *p = 0; line?

Zeiris, if you call a function with no declaration in scope, it is implicitly declared as a function returning int, with external linkage.

and antiquated calling conventions

nope…

Funky. Is that necessarily bad? I mean, it works, so are .h files with declarations strictly necessary?

JohnCC ill find it wait

just you wait!

while(*p == ‘ ‘) p–; (this be != at the end of the line, the ” right?)

you’ll have it mysteriously fail sometime

Zeiris, well, if ‘function returning int’ is not correct, the behaviour is undefined.

I mean, your code will link but it will crash horribly, or worse

that’s it!

Ah. So the implicit declaration could be horribly horribly inaccurate. I see.

Zeiris, implicit declarations were also removed in C99.

JohnCC yeah i figured out

there’s also the old argument promotions from the pre-ANSI days…

i am rewriting it so theres no malloc issue also
wait

if you always call the function with just the right argument (types) and your return values are always internally compatible with how int is handled … well, sure, it will work. but that’s a lot to get right.

are you sure even that is guarenteed?
I think it isn’t

implicit declarations are insane, any time you can have the compiler check something it should

not if the function is defined with the argument types in the arg list…

-Wall and -pedantic are your friends

depending on the types involved that may be a case where you just cant call correctly.

I think it also strips the leading whitespace as well as the trailing…

though possibly by some great coincidence it will seem to work anyway

Was about to ask, with what flags should I compile? I’ve got -Wall, will -pendantic and -ansi help or just get in my way?

JohnCC it strips the first whitespaces and the last
i rewrote it, works fine

aye, seem to work or works just fine, either is possible, and you can’t really tell the difference until the guano hits the oscillating device.

ahh, gotcha

Zeiris, it depends, -pedantic will be useful if you want to write code that you can be reasonably sure will compile on any standard compiler down the line

http://rafb.net/p/lJN7wt79.txt

i use -pedantic, i find it helpful

Spark, depends what Im doing I tend to periodically enable and disable -Wall and -pedantic, sometimes a warning can be benign but its better to see it and decide its benign then find out later that it isnt

cool, thanks

Hm. Both pedantic and ansi make the compiler go nuts over msvfw32.h… And stdio.h. And I think some other standard libraries.

use -isystem
not -I
turns off warnings for crappy headers
or system headers

would expect that to be the case on msvfw32.h (its a microsoft header by the looks of it )

the very name reeks of microsoft

on ” anvil anvil ” it returns “anvil anvil “

some MS libraries force you to write nonstandard code that breaks -pedantic
but then that’s what you get for using MS libraries

Microsoft not obeying standards, you lie!

so it seems to be a leading whitespace remover, rather than a trailing

the assumtions it requires may also be required by POSIX…

yeah but Microsoft and Posix have a relationship similar to that of a curb crawler and a whore
only reason MS included any POSIX support I think was becuase US Gov reg requirements required it, even then you had to use SFU or the newer SUA
finds it amusing that the success of Unix and later Linux has forced MS into a situation where they end up distributing GCC under the GPL

well how else would they distribute it?

are pthreads userland threads?

it’s kind of illegal to distribute it not under the GPL

sometimes.

SamB, violation of copyright indeed

implementation specific?

yes

what is userland?

the multithreading and schduling is done in a single process

funnily enough (since we where just talk about it), Microsofts Services for Unix implements pthreads on top of the native win32 thread system iirc

is that not just MKS toolkit?

pthreads do not specify how the threading is implemented

I heard MS finally implemented fork in Vista…

on linux it is in the kernel nowadays, but mmv

easytigher, no Services for Unix was Interix till they bought it out
easytiger, MKS produce a similar product (as does cygwin)

so when doing multithreading to make use of many cores… one should use pthreads?

what OS are you using anyway?

with linux these days its NPLT

… usually
I once had some issues with that…

well yeah, usually
its not compulsory

was trying to use the debugging libc that Debian provides…

knows where this is going..

Thanks for the -isystem tip spark, that’s really useful

unfortunately it didn’t have an NPTL pthreads…
anyway, that didn’t end well :-(

ubuntu 2.6.x

LD_ASSUME_KERNEL=2.4.1 ?

SamB, reentrant issues?

well I wanted to run with the NPTL, not linuxthreads

ah.

what other threading interface were you considering using?

NPTL is good now, was a bit hairy for a while when they introduced it though

never had to do threading in C before.. so i didn’t know many options

Im thinking of doing a project where threading might be useful but Im going to use C++ so Ill visit boost

I can’t think of any others really, but whatever others you may find are probably wrappers around pthreads anyway…

or the native platform threads

(at least on Linux)

I think thats what boost does actually (though thats off topic since boost is C++ not C)

you could use the preprocessor part in c, if you really wanted to abuse it

not really done much programming with threads but since the future is multi-core I should probably have a go at some point..better they bite me on my own projects than down the line

threading sucks in C
or C++
probably because of all that state

breaking news http://sports.yahoo.com/sow/news;_ylt=AkL7nO1EhadVuGAcpwKH848mw7YF?slug=ap-materazzi-zidane&prov=ap&type=lgns

SamB, threading sucks in just about every language, next big challenge I think

it sucks a bit less than usual in Haskell I think

so pthreads on linux does native threading?

hell look at the PS3, they build this tremondously fast processor (Cell Broadband Engine) but hardly knows how to program the fscking thing properly

orbitz isn’t here, no one’s going to say it

if the wizards at IBM have trouble figuring out how to do it what hope does your average applications programmer have , its a problem they are going to have to solve in the compiler

did anyone make any games for it yet?

SamB, saw a study that said that the compiler in most cases only gets a fraction of the performance of which the processor is theoretically capable..of course the situation will improve as the compiler does and the programmers figure out how to program it

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Comments are closed.