Next version of C++ as ambigous as today?


Is there any effort being made to move C++ toward having a less ambigous grammer/closer to LALR(1) John...
Posted On: Monday 26th of November 2012 12:14:33 AM Total Views:  82
View Complete with Replies

RELATED TOPICS OF C Language PROGRAMMING LANGUAGE




free(): invalid next size (fast)

I need help with this snippet of code which breaks down at the free() line. Code: /* called function */ unsigned char* func(){ unsigned long length = 9; unsigned char *p = NULL; p = malloc(size of (unsigned char) * length); /* error checking for p */ return p; } /* caller function */ . . p = func(); free(p); . . . I got the above mentioned error. what am I doing wrong
VIEWS ON THIS POST

202

Posted on:

Friday 28th September 2012
View Replies!

What does getchar do with the second next character from stdin?

What does getchar do with the second next character from stdin Example : example = getchar(); User input : ABC Output : A Where does the BC goes, Originally Posted by xeon321 What does getchar do with the second next character from stdin Example : example = getchar(); User input : ABC Output : A Where does the BC goes BC are maintained into the buffer.Try this code in oder to understand how this works. Code: char a; printf("Please type a word\n"); while(1) { a=getchar(); printf("%c\n",a); } , Originally Posted by xeon321 Hmm interesting example. Mind to explain why you use while(1) What does the 1 do In order the loop is infinite.Any nuber different that zero gives as a true statement,so the condition of while is satisfied,so our programm is going to enter the loop infinite times. For example Code: int a=5; if(a==5) { printf("entered the loop\n"); } is equivalent to (the message will be dispalyed For example Code: if(1) { printf("entered the loop\n"); } , Originally Posted by xeon321 Hmm, define what is correct input & wrong input while( example != 'Y'&& example != 'y') I thought this line means , except 'Y' & 'y', the rest of the characters are not accepted The code that you wrote is going to check only the first letter of the word.If the 1st letter is different than Y or y ,then user inputs another(or the same word).Your code is going to ckeck again only the first letter of the word. Originally Posted by xeon321 Mmm, and from where the computer knows the number is different than zero a is equal to 5 so a==5 is a true statement.True statements are equivalent as 1(boolean algebra) and false statements as 0. a==6 is a false statement,it is equivalent to zero
VIEWS ON THIS POST

114

Posted on:

Wednesday 3rd October 2012
View Replies!

Finding the next highest value in a int variable

I need a method or mechanism to find/sort the values stored in a struct member of type int. e.g proc[i].priority How or what can i use to deal with the values stored in the variable, so that i can process them in an ascending order such as all the 0's first and all the 20's last ( 0 - 20 ). I was thinking something like: Code: if ( proc[i].priority > previousproc[i].priority ) previousproc[i].priority = proc[i].priority; But i dont think this actually picks up the next number in the sequence and that it will choose any number up to 20, when i need it to choose all the 2 values stored in .priority first. then the 3's, 4's etc. If anyone could provide a suitable way about going about this it would be appreciated thanks, Originally Posted by oogabooga It depends on whether this list is created once and after that nothing is added or removed or whether the list is dynamically changing. If it's dynamically changing, then this is a job for something called a priority queue (which see). If it's fixed, you can just sort it however you wish (e.g. selection sort, if you want simplicity over efficiency) and process it in order. And of course you can use the standard library qsort as well. Code: for ( i = 0 ; i priority - ((process*)b)->priority; } Then elsewhere: Code: qsort(proc, number_of_procs, sizeof(*proc), comp); That will see it working correctly for you. yeah i tried that before but i kept getting these errors example.c: In function comp: example.c:29:14: error: process undeclared (first use in this function) example.c:29:14: note: each undeclared identifier is reported only once for each function it appears in example.c:29:22: error: expected expression before ) token example.c:29:48: error: expected expression before ) token
VIEWS ON THIS POST

202

Posted on:

Wednesday 17th October 2012
View Replies!

HELP!!!!!! Homework Validating ISBN w\ dashes due next week

I need to write a program that validates ISBN numbers in the that are 10 digits long with the 10 th digit being the check sum digit example ISBN: 0-13-240416-8 0+2*1+3*3+4*2+5*4+6*0+7*4+8*1+9*6=129 When 129 is divide by 11 the remainder is 8 check digit is 8. I have to write a program that will determine the string of characters entered only contain dash("-") and numeric characters ( in a 10 digit ISBN the dashes may be in different locations depending on the book publisher.). If characters are valid it must the calc. the check digit to determine if the ISBN is valid. I need to include user-written functions to. * validate input *calculate the check digit validity stlib. funct. for checking numeric values may also be useful. I have a basic idea of how to write a program in C++ Code: #include 002 #include 003 #include 004 #include 005 #include 006 #include 007 #include 008 #include 009 using namespace std; 010 011 void gotoxy(int x, int y) 012 { 013 COORD coord; 014 coord.X = x; 015 coord.Y = y; 016 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord); 017 } 018 019 void clrscr(int x, int y) 020 { 021 COORD coordScreen = { x, y }; 022 DWORD cCharsWritten; 023 CONSOLE_SCREEN_BUFFER_INFO csbi; 024 DWORD dwConSize; 025 HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); 026 GetConsoleScreenBufferInfo(hConsole, &csbi); 027 dwConSize = csbi.dwSize.X * csbi.dwSize.Y; 028 FillConsoleOutputCharacter(hConsole, TEXT(' '), 029 dwConSize, coordScreen, &cCharsWritten); 030 GetConsoleScreenBufferInfo(hConsole, &csbi); 031 FillConsoleOutputAttribute(hConsole, csbi.wAttributes, 032 dwConSize, coordScreen, &cCharsWritten); 033 SetConsoleCursorPosition(hConsole, coordScreen); 034 } 035 036 void main (void) 037 { 038 int isbn[5] = {11110, 12221, 13332, 24443, 25554}; 039 string book_title[5] = {"Binary Kibbles and Bits", "Syntaxico", "Vitamin C++", "Surf and Turf the Web", 040 "Java-lin: Olympic Favorite"}; 041 float retail[5] = {155.95, 116.75, 126.50, 125.75, 138.99}; 042 int i = 0; 043 int x = 6; 044 int qty = 0; 045 int y = 0; 046 float total = 0.00; 047 string option = "t"; 048 049 050 051 gotoxy(10,4); 052 cout
VIEWS ON THIS POST

116

Posted on:

Monday 22nd October 2012
View Replies!

for_each iteration in a std::list adds a new element and nextiteration crashes

Hi all, I have this code: class A { std::list m_observadores; void function() { ApplySendMessage apply(this, message); std::for_each(m_observadores.begin(), m_observadores.end(), apply); } } and, ApplySendMessage:perator() adds a new item to the list m_observadores under some conditions. I get (MSVC8.0) "list iterator not incrementable" in an iteration of for_each algorithm after adding (m_observadores.push_back) a new item to the list in the previous iteration (ApplySendMessage = AplicarEnviarMensaje): msvcp80d.dll!std::_Debug_message(const wchar_t * message=0x005fbf30, const wchar_t * file=0x005fbb50, unsigned int line=236) Lnea 24 C++ > libcliente.dll!std::list::_Const_iterator:perator++() Lnea 236 + 0x17 bytes C++ libcliente.dll!std::list::_Iterator:perator++() Lnea 399 C++ libcliente.dll! std::for_each(std::list::_Iterator _First=0x0249b93c, std::list::_Iterator _Last=0xcdcdcdcd, maevif::cliente::AplicarEnviarMensaje _Func={...}) Lnea 28 + 0x8 bytes C++ Is the iterator invalidated after the insertion or my error comes from another place Is this standard m_observadores.push_front instead of m_observadores.push_back will fix that Thank you.
VIEWS ON THIS POST

213

Posted on:

Saturday 3rd November 2012
View Replies!

next ISO C++ standard

Current ISO C++ standard is ISO C++ 1998. Am I correct When is the next standard expected What is the URL for knowing it Will it contain libraries for network programming as part of the standard library .(just as data structures and algorithms were included as part ISO C++ 1998 standard library). Kindly clarify.
VIEWS ON THIS POST

282

Posted on:

Saturday 3rd November 2012
View Replies!

Win32 C programmer here - what to learn next?

I used to write in Turbo C++ 3 for DOS waaaay back, then moved to writing C in 32 bit windows using the standard windows api. I took a many years off to pursue my musical career and now I'm realizing that if I want to code again I should look at a newer library/api. I took some win32 C code that worked fine in Visual C++ 6 and tried compiling it in Visual C++ Express 2008 and it did not compile. I checked all dependencies - includes, libraries - they were all there. I noticed the copyright on VC++ 6 was 1998, so I think its time for something new! I'd like to stick with C/C++. C/C++ would still be my language of choice, but I'm not sure what the modern options are besides C# and Java. I'm interested in developing gui and console based applications (no web apps). Any suggestions considering my background (As you can see I'm about 15 years behind...) MFC COM Borland BDE
VIEWS ON THIS POST

194

Posted on:

Sunday 4th November 2012
View Replies!

Thinking of your next holiday

Are you planning for vacation, holiday We would like you to spare your valuable time! Visit our website www.magical-nepal.com for information on Nepal, Tibet and Bhutan. Thanking you in advance visiting and look forward to assist you.
VIEWS ON THIS POST

179

Posted on:

Sunday 4th November 2012
View Replies!

Input control moves to next line automatically without using cout function

#include int main() { char n, m; puts (" Enter the first string and . to terminate :"); do { n = getchar(); putchar(n); }while(n !='.'); puts (" Enter the second string and . to terminate :"); do { m = getchar(); putchar(m); }while( m != '.'); return 0; } Output ------------ Enter the first string and . to terminate : 234. 234. Enter the second string and . to terminate : 2343. 2343.Press any key to continue ---------------------------------------------------------------------------------------------------------------------------- In the above program- output the i can't enter the value of the second string in the same line. Here control automatically moves to next line. ie., The value cannot be entered in the same line even there is no corresponding cout function.
VIEWS ON THIS POST

234

Posted on:

Sunday 4th November 2012
View Replies!

Reading of file by next of map file and by next of file descriptor.

How many times is map file faster than reading of file by next of file descriptor and when both times are so aqual one
VIEWS ON THIS POST

130

Posted on:

Monday 5th November 2012
View Replies!

next C++ standard

Next release of C++ standard: where to get information about it
VIEWS ON THIS POST

137

Posted on:

Monday 5th November 2012
View Replies!

Implemetaction a straw by next of memory at any allocator.

How do library name which it implementation a straw in C++ language by next of any alocator. This straw has property like what pipe width C language at unix. THans in advance.
VIEWS ON THIS POST

199

Posted on:

Monday 5th November 2012
View Replies!

Threading issue in next standard

Several days ago, James Kanze said that thread issues will be addressed in next standard. http://groups.google.com/group/comp....b6d8f6ce67f963 If this is true, I would like to know that: 1. How will the language and library overlap That is, threading will be purposed by library extension (like boost.thread), or adding new language constructs, such as keywords like "synchronized" 2. Is it possible that in the recent future we will have a C++ binding for threading If not, why 3. This is maybe a little bit off-topic, but it is said that Bjarne Stroustrup has been working with concurrent programming for at least 20 years, for what reason he (together with committee members) did not add threading to the language C++ predates POSIX Lack of manpower Or simply the complicity For this question I traced into D&E, but without any luck. Any comments are welcome. --- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
VIEWS ON THIS POST

163

Posted on:

Monday 5th November 2012
View Replies!

Thread in next C++ standard

I have read some times ago that next release of C++ standard will include multithreading. Is it still true (for sure) or has it beeen dismissed Thank you, Evolito.
VIEWS ON THIS POST

151

Posted on:

Wednesday 7th November 2012
View Replies!

The fashion keeps changing every day. The style and fashion you have adopted on one day is outdated on the very next day. So you have to remain updated regarding the latest developments in the fashion world. The revolution in fashion has brought abou

The fashion keeps changing every day. The style and fashion you have adopted on one day is outdated on the very next day. So you have to remain updated regarding the latest developments in the fashion world. The revolution in fashion has brought about a lot of changes in mens underwear. Designers every now and then introduce new and innovative Boxer Briefs and Shorts. But people worldwide don’t get an access to the latest undergarments on the offing. The website like 1underwearstore.com is a perfect solution to this problem. It not only displays a wide array of mens underwearonline, but it also offers them at affordable prices to its customers. Whether you wear briefs, boxers, trunks, crew necks or v-necks, it has got the newest Calvin Klein undergarments for you. please check it our site: at replicab2b.net
VIEWS ON THIS POST

238

Posted on:

Wednesday 7th November 2012
View Replies!

Input control moves to next line automatically without using cout function

#include int main() { char n, m; puts (" Enter the first string and . to terminate :"); do { n = getchar(); putchar(n); }while(n !='.'); puts (" Enter the second string and . to terminate :"); do { m = getchar(); putchar(m); }while( m != '.'); return 0; } Output ------------ Enter the first string and . to terminate : 234. 234. Enter the second string and . to terminate : 2343. 2343.Press any key to continue --------------------------------------------------------------------------------------------------------------------------------- In the above program- output the i can't enter the value of the second string in the same line. Here control automatically moves to next line. ie., The value cannot be entered in the same line even there is no corresponding cout function.
VIEWS ON THIS POST

182

Posted on:

Wednesday 7th November 2012
View Replies!

Re: next ISO C++ standard

On Tue, 2008-01-15 at 23:03 +0200, Ioannis Vranos wrote: > AFAIK , wchar_t supports the largest character set provided by the > system. So AFAIK wchar_t is Unicode on systems supporting Unicode. Am I > wrong somewhere I think it ...
VIEWS ON THIS POST

179

Posted on:

Saturday 10th November 2012
View Replies!

what is next?

all, Some months back i start learning C reading long list of books sure including The C programming language and type small program to do sample tasks backup/parsing-html ... etc try reading code from open source project but still ...
VIEWS ON THIS POST

117

Posted on:

Sunday 25th November 2012
View Replies!

Does lex+yacc produce a tree data structure that is easy for anexternal C++ program to examine and manipulate?

If the goal is to take a 1-dimensional package of text and produce a tree data structure that is easy to understand and manipulate, and then write C/C++ code that works with that tree - does lex/yacc suit that purpose ...
VIEWS ON THIS POST

188

Posted on:

Sunday 25th November 2012
View Replies!

Implemetaction a straw by next of memory at any allocator.

How do a library name which it implementation a straw in C++ language by next of any alocator. This straw has property like what the pipe width C language at UNIX.
VIEWS ON THIS POST

295

Posted on:

Monday 26th November 2012
View Replies!