Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: WebDrake
  • Content: Threads
  • Order by date
  1. WebDrake

    Tracing a rounding error

    I'm wondering if anyone can give any advice on tracing a rounding error in a program. I have two slightly different implementations of a process, which basically come down to the following. In Version 1, various increments are added to a double variable, and at the end I check to see if it is...
  2. WebDrake

    Code efficiency question

    Does anyone have any comments on which of these pieces of code will run more efficiently? In these code examples, check is a variable of type bool (it is an actual variable, not an expression that is reevaluated each time the if() statement is run), and i and N are unsigned ints. if(check) {...
  3. WebDrake

    Some issues with mixing C and C++

    I've started introducing some C++ modules to my code project (scientific number-crunching), where it's convenient to do so, and have been following the instructions at http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html for mixing code. A few things are niggling me, mostly trivial, but...
  4. WebDrake

    Array lengths

    Is there a maximum array length in C, other than the size of the computer's memory? ... and ... are there any functions in the standard library which might tell you the length of an array (other than strlen(), which I know about)?
  5. WebDrake

    Object-oriented programming: Objective-C or C++?

    Hello all, For my code work up until now (scientific number-crunching) I have used C, but there are a handful of cases where it would be useful to have some object-oriented programming (e.g. for simulation of traders bidding on a stock market, or similar multi-agent work). I've dealt with this...
  6. WebDrake

    Bizarre segmentation fault involving i/o of data

    As per my previous thread I went away and came up with a set of functions to help with data input. Unfortunately a segmentation fault is now showing up, apparently due to one of these functions, and I can't work out why. Here's the code: #include <stdio.h> #include <stdlib.h> #include...
  7. WebDrake

    Dynamic input of strings

    Hello all, I've been trying to work out how to dynamically input strings---i.e. to be able to input a string without first deciding what size it should be. Here's a test program: /* iotest.c */ #include <stdio.h> #include <stdlib.h> int main(void) { int i, stringsize; char info1[127]...
  8. WebDrake

    Running C programs in the Linux shell

    I have a C program which basically does the following: (1) Prints a load of questions and scanf()'s responses (2) Runs a simulation based upon the input, and prints out numbers on the screen (1, 2, 3, ...) using printf() to let me know how it's progressing. What I often do is suspend the job...
  9. WebDrake

    static elements in a module

    Hello all, One of the functions I use in my code is a modified form of a module in the GNU Scientific Library, which follows this post. Note that the "seed" for the random number sequence is contained in the variables x_ran2, y_ran2, n_ran2, shuffle_ran2. Now, this is a module, so... these...
  10. WebDrake

    warning: integer overflow in expression

    Hello all, I've got a warning coming up in some code that I don't understand (the subject line should tell you what it is:-)). The lines in question are implementations of the following macros that I've written as a very simple mechanism for code to exit gracefully in the event of a memory...
  11. WebDrake

    Using Cisco VPN client 4.6 with SUSE 10.0

    Hello all, I'm trying to set up Cisco VPN client 4.6 to allow me to connect to my university network remotely. My OS is SUSE Linux 10.0. The actual software is installed, and, as root or superuser, I can log onto the VPN, which gives me a university IP address via the connection cipsec0. (I...
  12. WebDrake

    Antivirus software &amp; email scanning for laptop with SuSE 10.0

    Hello all, I'm running SuSE 10.0 on my laptop, and I have clamAV installed on there. However, I'd like to get antivirus stuff a bit more friendly. On Windows I use NOD32 and if I could get something for Linux with the same functionality and ease of use, I would be a happy bunny. In...
  13. WebDrake

    Forwarding serial port to a virtual port

    Hello all, A project necessity has come up which, to be honest, I have no idea how to start working on, so I thought I'd ask here. :-) The problem is this: we need to write a program that will read from the serial port and forward to a virtual port of our choosing. Of course, it's not just...
  14. WebDrake

    Easy switching between different variants of a keyboard layout

    Hello all, I'm using SuSE Linux 10.0 with KDE 3.4.2 Level "b" on my Dell Inspiron laptop. The keyboard layout is United Kingdom, and this works fine; but I have found it impossible to have an easy way to switch between the basic and international variants of this layout. Most of the time the...
  15. WebDrake

    SUSE 10.0 problems

    Hello all, I've just installed SUSE 10.0 on my laptop in dual boot with XP. Previously I had Ubuntu 5.10 installed... In general it seems very nice but I have a couple of problems---one irritating, the other a bit more serious. The serious one is to do with setting up Thunderbird. I managed...
  16. WebDrake

    signed and unsigned char

    Hello all, I've heard that it's good practice to always declare char variables as signed or unsigned. Could anyone comment? Is it worth it? In addition, under what circumstances should one declare one or the other? I note that when I tried to compile a program under Linux with all unsigned...
  17. WebDrake

    Syntax errors and queries

    Hello all, I've been adapting some code from the GNU Scientific Library (GSL) for my own evil purposes. The following is a random number generator "ran1" (same algorithm as found also in Numerical Recipes for C): #define N_SHUFFLE 32 #define N_DIV (1 + 2147483646/N_SHUFFLE) static const...
  18. WebDrake

    Makefile and object file locations

    Further to my previous question about modularizing code, when I want to compile source to object files, is there any way of determining where the object files are located? e.g. gcc -c [all the source files] just produces objects in the present directory. But suppose I wanted to put all the...
  19. WebDrake

    High-quality C math libraries

    Could anyone recommend a really good math library for C? I note that the standard math.h library often takes variable values as input. My practice is where possible to pass pointers to functions. Do all these maths functions really need to use the passed data destructively? Is there a math...
  20. WebDrake

    Splitting programs into multiple .c files

    Hello, Suppose I wanted to split my code into separate modules, as is quite common for large applications. I'm talking about the sort of thing where one compiles, gcc file1.c file2.c file3.c -o bigfile What sort of effect does this have on performance? Does it improve or harm things? I'm...

Part and Inventory Search

Back
Top