636 Posted Topics

Member Avatar for lilbenji25
Member Avatar for nezachem
0
205
Member Avatar for JDevelop

To compile individual files you have to either write an individual rule for each object, or use a generic rule as [CODE]%.o: %.c $(CC) $(CFLAGS) -o $@ $<[/CODE] (refer to [I]automatic variables[/I] chapter in [ICODE]info make[/ICODE] for the meaning of @ and <). Put this rule in place of lines …

Member Avatar for nezachem
0
8K
Member Avatar for gerard4143

[CODE]#include <stddef.h> ... * (int *) (((char *) sptr) + offsetof(struct mys, value)) = 1234;[/CODE]

Member Avatar for Narue
0
164
Member Avatar for BLUEC0RE
Member Avatar for IamAuser

[QUOTE=rubberman;1522376]When you run into that problem, you will discover that you have 10K lines of code to fix... Be safe. Read the ANSI/ISO C++ standard. They are very clear on this point.[/QUOTE] Chapter and verse, please? 18.1-3 totally contradicts to what you say.

Member Avatar for IamAuser
0
271
Member Avatar for hawita

[CODE] cin>> cn; int M [cn][cn];[/CODE] Don't do that, ever. Unfortunately it may work - but in fact you cannot initialize an array of unknown size like that. Even if the above worked, you are using [CODE]cn+1[/CODE] as loop limit. That is, the last time around, the loop counter is …

Member Avatar for abhimanipal
0
99
Member Avatar for jfunchio

Lines 163 and 190 don't do what you want them to do. Besides, the way you set up your constructors, the _subject is uninitialized.

Member Avatar for nezachem
0
122
Member Avatar for dondajr

[B]> Can anyone explain me what I'm doing wrong?[/B] Sure. [B]> If I call display after destroy, the display continues showing the data after the second node.[/B] Question is, what do you expect? After destroy, an access to the list invokes an undefined behaviour. That is, once the list is …

Member Avatar for dondajr
0
273
Member Avatar for abhimanipal

[QUOTE=Ancient Dragon;1519883]the return value of malloc could not be typecast as char* because that it the wrong type.[/QUOTE] Confused as always. malloc returns [ICODE]void *[/ICODE], which of course [B]can[/B] be typecasted to anything. As for the original question: [B]I run the code and the O/p is 10.[/B] Try to run …

Member Avatar for nezachem
0
142
Member Avatar for triumphost

There is a Makefile. All you need to do is to type [ICODE]make windows[/ICODE] or [ICODE]make linux[/ICODE] (depending on what system you are on) at the command line.

Member Avatar for triumphost
0
115
Member Avatar for ztdep

The copyright on MET claims 2001. No wonders. There's no such thing as iostream.h anymore. It is obsoleted. Your options are: 1. Find some fairly old compiler (they say gcc version 2.95 works... good luck with it) 2. Audit the code and get it up to the standard 3. Dump …

Member Avatar for ztdep
1
144
Member Avatar for happygeek

>> CAn we trust wikipedia ? > No. Can we trust DaniWeb? The top 100 posters (that's [B]0.1%[/B] of the population) contributed 365917 posts (that's [B]25%[/B] of the post count). An estimated contribution of the next hundred is at least 100000. PS: The [URL="http://www.daniweb.com/certificates/stats.php"]statistics[/URL] page gives the top hundred. Is …

Member Avatar for TrustyTony
0
477
Member Avatar for vegaseat

[B]> That ends the debate. [/B] Well, as programmers we must realize that the debate never ends. Besides, neither approach looks pythonic enough to me. Since you already have the performance test set up, could you add the following? [CODE]def loop(text): def looper(t): while True: for c in t: yield …

Member Avatar for TrustyTony
3
7K
Member Avatar for hansel13

There are several problems with this code. 1. The producer locks the queue for much too long. The mutex can be safely released right after the queue entry is unlinked. In fact you make your producers to run sequentially, and since the file IO is a very time consuming operation, …

Member Avatar for funter
0
2K
Member Avatar for rockerjhr
Member Avatar for gaurav_13191

You are calling pop() twice. Replace lines 182-185 with [CODE] temp = pop(s); if(temp == NULL) return;[/CODE]

Member Avatar for gaurav_13191
0
187
Member Avatar for anurag.kyal

[CODE] pthread_create(&th[i], NULL, func_sort, (void*)arg1);[/CODE] You pass the same argument to all threads. Remember, that threads are running in the common address space, so a single copy of arg1 is shared among them. You need to create distinct individual arguments for each thread.

Member Avatar for nezachem
0
199
Member Avatar for volkang

The only problem with the java implementation is that (besides being overdesigned) it wouldn't work in the OP situation: [I]the bounds t to infinity[/I].

Member Avatar for volkang
0
168
Member Avatar for John Linux
Member Avatar for virtue

A missing separator usually means that the rule line doesn't start with the tab. Make sure that there's no empty line between the dependency and the rule, and that the rule is indented with the tab - spaces do not work.

Member Avatar for thekashyap
0
171
Member Avatar for spe_eddy

[URL="http://support.microsoft.com/kb/828801"]Excel statistical functions: TREND[/URL] [INDENT]The TREND(known_y's, known_x's, new_x's, constant) function is used to perform Linear Regression. A least squares criterion is used and TREND tries to find the best fit under that criterion.[/INDENT] Is that what you are looking for?

Member Avatar for spe_eddy
0
479
Member Avatar for cupcake33

Two immediate questions: 1. Why do you think it should work properly? 2. What makes you think it doesn't? First question implies the environment (true 8088 vs emulation; where 6000h came from; interrupt state, clock frequency). The second implies, how do you measure the actual delay.

Member Avatar for cupcake33
0
466
Member Avatar for iamcreasy

[B]> Some compilers, such as GCC, automatically initialize integers to 0[/B] Correction. No compiler initialize an auto variable to anything. Every compiler initialize static variables to 0 (this is mandated by the Standard). [B]> issue a warning [/B] At a proper warning level GCC will issue a warning as well.

Member Avatar for template<>
0
19K
Member Avatar for kristo5747

In your second script the N command does join a current pattern space with the next line; however the s command causes the (updated) pattern space to be printed out. Essentially, you join pairs of lines. My recommendation would be to use a hold buffer, and careful addressing like this: …

Member Avatar for kristo5747
0
162
Member Avatar for NickJoe

[B]> lets say the number is 110001000100 and n is 2...[/B] ... so after the shift it becomes 111100010001, and you need to get rid of the 2 leading ones, right? Hint: what happens if you shift 100000000000 right by one (that is, by n - 1)? I didn't see …

Member Avatar for gerard4143
0
278
Member Avatar for az_ez

Two problems with the code. An immediate and major one is that [CODE] char writefile[1000000];[/CODE] attempt to allocate one million characters (that is one megabyte) on the stack. The stack is a very limited resource. For example, Windows by default gives one megabyte for the whole stack, and by the …

Member Avatar for az_ez
0
379
Member Avatar for efronefron

Add fflush() right after fprintf(). Quoting man fsetpos: [INDENT]The fsetpos() function shall fail if, either the stream is unbuffered or the stream's buffer needed to be flushed, and the call to fsetpos() causes an underlying lseek() or write() to be invoked[/INDENT]

Member Avatar for efronefron
0
287
Member Avatar for Zjarek

[B]> Am I doing it wrong?[/B] Yes. Initialize vg once for the m you need. To get a random number, instead of rand()%m just call vg().

Member Avatar for Zjarek
0
484
Member Avatar for george61

Hint: You don't need to calculate hexagonal numbers. You just need to test if a given number is hexagonal. In other words, find out if the equation [B]x*(2*x - 1) = P(i)[/B] has integer roots.

Member Avatar for george61
0
869
Member Avatar for samppb

To be precise: start() is not an interface method for Runnable. It is a Thread method. Invoking thread.start() results in spawning the thread and executing the Runnable's run() method in it. Since you are not extending Thread (which I wouldn't recommend to do), the call at line 68 does not …

Member Avatar for Ezzaral
0
127
Member Avatar for TigrisAltaica

[B]> changing the size of the array[/B] This is right. In your original code you were trying to allocate 4 megabytes of data on the stack. The default stack size is 1 meg.

Member Avatar for TigrisAltaica
0
154
Member Avatar for geoffy0404

[B]> Everything posted is fine.[/B] You sure? [CODE] int grade1 = 0; char grade1 = 'A'; // this is where it fails [/CODE]

Member Avatar for geoffy0404
0
169
Member Avatar for b56r1

[B]> But which character has the ASCII value of 0XFF is -1[/B] The stream you are reading is not necessarily textual. getchar() must read any data.

Member Avatar for b56r1
0
119
Member Avatar for b56r1

[CODE]printf("%d %d %d\n",a=10,a=20,a=30);[/CODE] [B]> expression statements separated by commas[/B] This is not a comma expression - this is an argument list. They look very similar, but they are really different creatures (think about this: the comma expression yields just one value). In the argument list case there's no guarantee in …

Member Avatar for pheininger
0
111
Member Avatar for chester1908

The most immediate problem is on lines 14 and 28; the local definition of catalogue shadows the global definition (didn't you get a compiler warning?). I am not sure what exactly happens, but it is pretty much possible that you sort one array, and print another. For example, appendEntry surely …

Member Avatar for chester1908
0
563
Member Avatar for Thristan_

os.walk returns the filenames without the path prefix. That is, you are trying to open them in the current directory, where they do not exist. change line 7 to [CODE] f = open(os.path.join(subdir, file), 'r')[/CODE] PS: your variable names are misleading.

Member Avatar for richieking
0
421
Member Avatar for aeinstein

[B]> are outside the definition of tokens[/B] No. The Standard defines token as either of: [INDENT]keyword identifier constant string-literal punctuator[/INDENT] and punctuator in turn is either of [INDENT][ ] ( ) { } . -> ++ -- & * + - ~ ! / % << >> < > <= …

Member Avatar for aeinstein
0
191
Member Avatar for ejiroy

At line 10 you open a file as prompted. At line 16 you immediately discard the result and open another file, which name is given as a command line argument. Which one do you really want? PS: if the command line has no arguments, the result is pretty much undefined.

Member Avatar for nezachem
0
113
Member Avatar for Stefano Mtangoo

Sorry if I sound too US-centric. In the USofA, nothing is legally certain unless the judge rules on it. The GPL has been tried several times in the court of law, but each case yet has been settled. No ruling has been produced. That is, nobody knows what exactly does …

Member Avatar for Stefano Mtangoo
0
452
Member Avatar for Utsav Chokshi

Sorry, you are all wrong. You may have as many mains as you want, provided they are all static (except one, of course). I am not even talking about dll tricks. > there is nothing like a good test Not for the questions like this. Language is defined not by …

Member Avatar for nezachem
0
244
Member Avatar for Goalatio

> All of the 32bit tutorials Looks like you missed [URL="http://en.skelix.org/skelixos/tutorial02.php"]this[/URL], which accidentally comes first on a [U]protected mode screen access[/U] google search.

Member Avatar for Goalatio
0
129
Member Avatar for Bladtman242

// this appears to be causing the trouble No. It is line 9. The error message points to line 17. There you call read with no arguments, while the definition of ReadIn.read requires one.

Member Avatar for Bladtman242
0
222
Member Avatar for Dexxta27

[CODE]int input(worker_t *); ... worker_t foo; input(&foo); ... worker_t employee[10]; input(&employee[5]); input(employee + 5);[/CODE]

Member Avatar for Dexxta27
0
154
Member Avatar for VernonDozier

[B]My question is why do we even need AtomicInteger.[/B] It is not about mutability. An Atomic prefix suggests that its methods are sefe in the multithreaded environment without additional synchronization.

Member Avatar for VernonDozier
0
1K
Member Avatar for ana_1234

[B]> if it contains a loop, i.e is a circular linked list[/B] Not exactly. The loop not necessarily includes the head (consider 1->2->3->2). In that case your algorithm will run forever. The solution takes two pointers traversing the list with different "speeds": [CODE]pointer1 <- head pointer2 <- head do: pointer1 …

Member Avatar for mrnutty
0
148
Member Avatar for fg_aa_c

Try perror instead of printf. That will give you a more hintful error message.

Member Avatar for fg_aa_c
0
1K
Member Avatar for 1g0r

Code tags! [CODE]org $4000 Alph equ 26 26 Alphabets begin: lea LC,A0 store lowercase to A0 lea UC,A1 store uppercase to A1 move.b #Alph,d1 sub.b #1,d1 loop: move.b (A0)+,d0 convert LC to UC sub.b #32,d0 move.b d0,(A1)+ dbra d0,loop goes back to loop move.b #9,d0 TRAP #15 org $4100 LC …

Member Avatar for nezachem
0
396
Member Avatar for jacob21

[B]> I don't see why the function has to be so complicated..[/B] Mostly because it reverses [I]characters[/I] in the string, not the [I]words[/I]. But it is a good start. Once the characters are reversed, you can apply the same function to each individual word, and reach the goal.

Member Avatar for gerard4143
0
113
Member Avatar for rjbrjb777

[B]> gives error that undefined reference "exp"[/B] Including math.h is not enough. You need to link with the actual math library. How exactly do that depends on your compiler. Check the documentation.

Member Avatar for rjbrjb777
0
2K
Member Avatar for iammirko

Call GetLastError() and display it with FormatMessage(). That will give you textual explanation of why "Attempt to bind failed". Besides that, the port value in sockaddr should be in the network byte order. Use htons() (or a whatever winsock provides for that matter). sin_addr is also conventionally assigned via interface …

Member Avatar for iammirko
0
241

The End.