Fourth root of integer1438 (5/16/2011 3:30:50 AM) comp.programming Looking for an algorithm to find the fourth root of a large integer (I have a multi-precision integer library already). If there is no exact fourth root then the floor or ceiling is OK, I don't need a 'remainde... Old
Same pointer parameter const and non-const327 (11/3/2009 12:56:56 AM) comp.lang.c Is this program guaranteed to print 10, or can the compiler get 'confused' by the const and assume the variable still has its initial value? #include int func(int *A, int const *B) { *A = 10; return *B; ... Old
Behaviour of istream_iterator on closed stream923 (7/29/2009 5:54:08 AM) comp.lang.c++ Code snippet: std::ifstream file( "does_not_exist" ); std::vector file_vec; std::copy( std::istream_iterator(file), std::istream_iterator(), std::back_inserter(file_vec) ); if ( file_vec.empty() ) ... Old
Setting the length of a file537 (3/20/2009 7:32:30 AM) comp.lang.c Is there any way to set the length of a file that I've opened with fopen(filename, "r+b") ? (I want to make the file shorter). I want my code to work in both Unix and Windows; in Unix there is a function ftrun... Old
fwrite etc. in Linux1262 (3/18/2009 6:19:03 AM) comp.unix.programmer I am porting some code from an embedded device to Linux. The code assumes that it is safe to write bytes in the middle of a disk file. I have tested this on a Linux PC, opening a file with fopen(filename, "r+"... Old
Bad initialization example in standard?126 (9/1/2008 1:40:25 AM) comp.lang.c++ In 12.6.1 of n2521, it says: "When an aggregate (whether class or array) contains members of class type and is initialized by a brace- enclosed initializer list, each such member is copy-initialized by... Old
Pointer to small amount of storage2826 (2/22/2008 2:37:06 PM) comp.lang.c Is there undefined behaviour here: #include int main() { short *p = malloc( sizeof *p ); long *q = (long *)p; q; return 0; } Rationale being that evaluating q causes undefined behaviour because q i... Old
Rationale for 21.3.4p11025 (12/11/2007 4:58:42 AM) comp.lang.c++ It was brought to my attention today that the Standard (1998 version, anyway) says that if s is a const std::string, then: s[s.size()] is well-defined and evaluates to 0. Why is this? It seems to me that it... Old
Legal to override same function in different bases?343 (10/7/2007 11:52:03 PM) comp.lang.c++ Is the following code well-defined, and outputs foo twice? #include struct Base1 { virtual void foo() = 0; }; struct Base2 { virtual void foo() = 0; }; struct Derived: Base1, Base2 { void foo(... Old
switch and many case's. Any caveats?3536 (5/8/2012 6:50:51 PM) comp.lang.c I am using a (some pseudo code): switch (i) { case 1: ... case 2: ... ... case 249: ... case 250: ... } where I have a couple hundred case's. Does this degrade performance a... Test
A question for this group...3350 (5/15/2012 5:41:01 PM) comp.lang.c If somebody asks: Why does it hurt when I stick my finger in a light socket? Is it universally true that the only possible answer is: Don't stick your fingers in light sockets. Is it really true that an e... gazelle3(1598)
why i get segmentation fault, where is the bug?525 (5/21/2012 10:50:28 AM) comp.lang.c++ hi to all, i am a newbie to C++ and i want some help if you could ... i try to implement a recursive linera search algorithm for learning purposes but i get segmentation fault. here is the code. the problem a... demosthenesk(1)
Need help in understanding below code437 (6/18/2012 2:30:00 PM) comp.lang.c++ Hi All,
I am trying to learn c++. I studied that construct does not
return anything and can be used
to intialise only objects data memebers. Could someone explain how
following is code is compilin... jagankumar.koti(3)
"this" pointer get corrupted after function call1152 (6/27/2012 6:36:01 AM) comp.lang.c++ Hi all,
well this is pretty much confusion to me as well, but here is
scenario. I have two shared objects file and one loader executable.
loader calls extern function in shared1 , which has one class ,
in... krishs.patil(5)
C/C++ question about dynamic "static struct"13637 (10/17/2012 9:49:54 AM) comp.lang.c++ Hi,
I have a static struct, defined in a C header file as something like
typedef struct
SomeStruct {
char *name;
int kind;
int value;
}
and I need to supply (in C++) values to an array ... gus4133(4)
kandr2 question8437 (10/30/2012 10:10:09 PM) comp.lang.c �1.9 page 29 has this function.
int getline (char s[], int lim)
Unless I'm missing something here to pass an array shoudn't that first
parameter be char *s ?
Bill
... nospam116(1187)
Why is (void **) not compatible with (foo **) ?723 (11/8/2012 10:08:26 AM) comp.lang.c Hello,
I know (void **) is not "compatible" with (foo **) but I'm wondering why.
I can write void *pv = 0; int *pi = 0; pv = pi; pi = pv;
Why is a pointer to v not be compatible with a pointer to i?
... Noob