User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
DaniWeb is a massive community of 397,633 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,352 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Showing results 1 to 40 of 78
Search took 0.01 seconds.
Posts Made By: perniciosus
Forum: C Dec 24th, 2005
Replies: 2
Views: 1,032
Posted By perniciosus
Re: A Very Simple Recursionn

m(x) = x < 3 ? 0 : m(x - 1) + m(x - 3) + 1
Forum: C Dec 22nd, 2005
Replies: 27
Views: 4,064
Posted By perniciosus
Re: mock test question, can anyone help

*Edit) __asm__("movl %eax, %eax") ;
Forum: C Dec 15th, 2005
Replies: 3
Views: 1,160
Posted By perniciosus
Re: Link List Move Method

What is wrong with using the functions you already got

void Sequence::move(int from, int to)
{
SeqItemType item = find( from )->item ;
remove(from) ;
insert( to, item ) ;
}
Forum: C++ Dec 15th, 2005
Replies: 4
Views: 1,240
Posted By perniciosus
Re: Doubts in C

Q1: Alternative 1
Q2: If the function X returns an integer, uses standard calling convention (and possibly is not dynamically linked, I'm not sure about the actual meaning of...
Forum: C++ Dec 15th, 2005
Replies: 4
Views: 978
Posted By perniciosus
Re: C in my PC

Well here is as modern as you are like to get, and all free
http://msdn.microsoft.com/vstudio/express/visualc/default.aspx
Forum: C Dec 14th, 2005
Replies: 4
Views: 1,410
Posted By perniciosus
Re: initializing a hash_set ?

Yes, hash_map is probably the correct thing to use in this case...

Hmm, one problem is you are using different types, that iterator is not neccecarily the same as the one returned (might work...
Forum: C Dec 14th, 2005
Replies: 4
Views: 1,410
Posted By perniciosus
Re: initializing a hash_set ?

Template arguments are <class _Value, class _HashFcn, class _EqualKey, ... >
You probably only need to redifine _HashFcn thought...

struct newHashFnc
{
size_t operator(const Point3D &p3d)
{
...
Forum: C Dec 14th, 2005
Replies: 15
Views: 2,391
Posted By perniciosus
Re: Memory Leak?

Where do you find such exception information? It should be written down somewhere on msdn like most error codes I guess (link please)?
(I've already explained the difference, if you do not want to...
Forum: C Dec 14th, 2005
Replies: 15
Views: 2,391
Posted By perniciosus
Re: Memory Leak?

Well thats windows for you... unkown software exception... sugestion: debug program to try to get a full stack trace of where the exception occurs.
Forum: C Dec 14th, 2005
Replies: 15
Views: 2,391
Posted By perniciosus
Re: Memory Leak?

But what does the exception say ? (In (win32) c you hardly get exceptions unless its fatal, such as dereferensing a null pointer, or running out of memory)...
Forum: C Dec 13th, 2005
Replies: 1
Views: 769
Posted By perniciosus
Re: Trying to understand this code???

Try reading up on quicksort in general... The loop (lines 2-9) make sure that all the low values are in one range and the high values in the other... The recursive calls (lines 10,11) then does the...
Forum: C Dec 13th, 2005
Replies: 15
Views: 2,391
Posted By perniciosus
Re: Memory Leak?

As I said char pBuf = char[1000025]; is syntax error and does not mean anything...
char pBuf[10000025]; mean declare as local variable and store on stack
char *pBuf = new char[10000025]; mean declare...
Forum: C++ Dec 13th, 2005
Replies: 3
Views: 949
Posted By perniciosus
Re: File I/O Question

ofcourse, there is plenty of ways to do this... you could for example store the previous value...

current_value = file.getc() ;
if( current_value == 'j' && previous_value == 'j') {
// We got our...
Forum: C Dec 13th, 2005
Replies: 15
Views: 2,391
Posted By perniciosus
Re: Memory Leak?

I suppose you mean char pBuf[LARGE_INTEGER_VALUE], the usual problem with that is you easily get stack overflow due to restrictive stack memory allocation, even if I doubt you need such a large...
Forum: C++ Dec 13th, 2005
Replies: 3
Views: 949
Posted By perniciosus
Re: File I/O Question

switch only operate on a single integer value... however since a char is smaller than an integer I suppose you could stack it in one value and then do the switch

value = ((value << 8) & 0xff)...
Forum: C Dec 13th, 2005
Replies: 15
Views: 2,391
Posted By perniciosus
Re: Memory Leak?

Because you dont release the memory ? (There is no delete matching the new)... (However most implementations of delete would not actually return the memory to the system anyway, it would just put it...
Forum: C++ Dec 10th, 2005
Replies: 4
Views: 2,047
Posted By perniciosus
Re: Replacing strings that are not case sensitive

Sugestion: Use regex, produces just about the fastest searches possible (you need a external library thought, I doubt it comes included in vc++ atleast I havent seen it, boost.org is one good source).
Forum: C++ Dec 10th, 2005
Replies: 7
Views: 1,510
Posted By perniciosus
Re: Some thingthat we can do in C and Not in C++

Aha... implicit function declarations ! Rather weak thought, but it feels the same as saying something that can not be done in c but in c++, both are complete turing machines and can as such do...
Forum: C++ Dec 10th, 2005
Replies: 3
Views: 944
Posted By perniciosus
Re: complex declarations & other doubts

1)
Just work your self out from the middle, if they are given in k&r they describe them in k&r ?
char(* (*f())[]) ()
*f() => f is function pointer taking zero arguments
returning (* ... [])() =>...
Forum: C++ Dec 7th, 2005
Replies: 3
Views: 1,825
Posted By perniciosus
Re: C++ to ASM

IANAAP (I Am Not An Assember Programmer) but, some thoughts:
Feels like there is as many ways to write assembler as there are assemblers thought... What is the problem ?

Argh, whats up with the k...
Forum: C Dec 7th, 2005
Replies: 2
Views: 978
Posted By perniciosus
Re: where am i going wrong!!sort & crit count

Suggestion, use qsort of stdlib.h (I think)...
you only need to write the compare function and specify the struct size.
Forum: C Dec 7th, 2005
Replies: 9
Views: 1,864
Posted By perniciosus
Re: Trouble with Pointers and Arrays

if you were to do printf("%p == %p ?\n", changingString, msgs[numMsgs] ) You would find that both pointers are identical... Either create a new string and copy the value over

msgs[numMsgs] = new...
Forum: C Dec 7th, 2005
Replies: 9
Views: 1,864
Posted By perniciosus
Re: Trouble with Pointers and Arrays

delete what?
(this should work, included some possible errors I could think of)

vector <char*> constArray(10);
char* changingString = "hello";

delete constArray[0] ; // error, not...
Forum: C Dec 7th, 2005
Replies: 6
Views: 1,215
Posted By perniciosus
Re: Algorithms checking

There is something called formal programming or something similar that enables you to state post and preconditions allowing you to "prove" that your code does what you say it does (might have been...
Forum: C Dec 7th, 2005
Replies: 9
Views: 1,864
Posted By perniciosus
Re: Trouble with Pointers and Arrays

Well you got a strange compiler, mine outputs hello, hi...
the constArray[0] points to the static string "hello", if you want to point at the pointer pointing to hello you gotta do &p...
allocating a...
Forum: C Dec 6th, 2005
Replies: 6
Views: 1,215
Posted By perniciosus
Re: Algorithms checking

Saying perhaps it is and the can, but me does not understand
(courtesy of our favorite translator babelfish)...
Forum: C Dec 6th, 2005
Replies: 4
Views: 1,571
Posted By perniciosus
Re: performance benefit by not calling static member function by object

Well it seem I was wrong...

btw, no it will not be called through the object, it is only used for name resolution, only virtual functions will be called through virtual tables...

(try assembler...
Forum: C++ Dec 6th, 2005
Replies: 2
Views: 745
Posted By perniciosus
Re: help!

Well the only book I read is Introduction to Data Compression, it contains a couple of chapters on Text compression... However this is mainly theoretical, and probably more use for understanding than...
Forum: C Dec 6th, 2005
Replies: 4
Views: 1,571
Posted By perniciosus
Re: performance benefit by not calling static member function by object

Well my first hunch was no ofcourse there would be no difference calling how you call a static member function, the class / object would only be used by the compiler to mangle the name... Thought I...
Forum: C++ Dec 6th, 2005
Replies: 11
Views: 1,787
Posted By perniciosus
Re: wrong output

Well then, thanks for including algorithm, I had a feeling it could be done but I did not feel like adlibbing it... (I assume it is correct even if it looks a little odd at times, may be smart...
Forum: C++ Dec 5th, 2005
Replies: 11
Views: 1,787
Posted By perniciosus
Re: wrong output

Thoughts:
case ')': Should probably output all ops untill a '(' is found on the stack.
The Big if statement on operators should probably be broken up, empty and '(' cases looks correct, but...
Forum: C++ Dec 5th, 2005
Replies: 11
Views: 1,787
Posted By perniciosus
Re: wrong output

Well I have been thinking about this one, I _could_ make a full parser (which would essentially parse the full expression tree and the spit it out after some tinkering)... however this solution you...
Forum: C++ Dec 5th, 2005
Replies: 11
Views: 1,787
Posted By perniciosus
Re: wrong output

Well it does not output numbers since you dont print them (obviously) currently whenever a number is encountered the switch statement will fall through to the output stackopt statement producing the...
Forum: C++ Dec 5th, 2005
Replies: 6
Views: 2,081
Posted By perniciosus
Re: Beyond C++ console program..

I have been stuck in your corner for quite a while, guess I ran out of time... I also recommend that first book since it will tell you what all those classes in MFC does, really...

(Saw an example...
Forum: C++ Dec 5th, 2005
Replies: 11
Views: 1,787
Posted By perniciosus
Re: wrong output

These things are more easily done using yacc and bison... I have a vague recollection about some statements of implementability of these types of grammar on a stack based machine so I suppose it...
Forum: C Dec 5th, 2005
Replies: 4
Views: 1,234
Posted By perniciosus
Re: array struct display??

man is your saviour, do man qsort or get your libc.hlp from devcpp if you are on win...

for a struct of type

struct tuple {
char artist[50];
char album[50];
char label[50];
int year[4];
char...
Forum: C++ Dec 4th, 2005
Replies: 10
Views: 1,620
Posted By perniciosus
Re: Cryptology

Short note, since you seem to have io well in hand just do man fopen and you will have what you need... (You can use the same functions for files as for standard input/output if you have a FILE*...
Forum: C Dec 3rd, 2005
Replies: 3
Views: 1,117
Posted By perniciosus
Re: Ruby Language

A somewhat odd introduction to ruby... (an interpreted language, with features comparable to python, or so I've heard).
http://poignantguide.net/ruby/
Forum: C++ Dec 3rd, 2005
Replies: 3
Views: 997
Posted By perniciosus
Re: Please someone help me

bool Siblinb::operator<( const Sibling &other )
{
return age < other.age ;
}

...
#include <algorithm>
...

std::sort( siblingobj, siblingobj + num_siblings ) ;
Forum: C Dec 2nd, 2005
Replies: 2
Views: 971
Posted By perniciosus
Re: sort in unix--help

Lol, so now I'm not an expert on linux utilities but I enjoy tinkering with it now and then... This is one way to solve _this_ problem, somehow I thought it would be possible to use the -k flag for...
Showing results 1 to 40 of 78

 
All times are GMT -4. The time now is 9:57 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC