dev-cpp-users Mailing List for Dev-C++ (Page 133)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Paul D. <pa...@po...> - 2005-05-10 19:00:39
|
I too am interested in finding out about this.... Malcolm Nealon wrote: >Hello Dev-cpp-users, > >Does anyone have an example of implementing pre-compiled headers in a >project, or just a sample which uses pre-compiled headers. > >Is there a tutorial anywhere? > >All help appreciated. > > > -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.7 - Release Date: 09/05/2005 |
|
From: Malcolm N. <m.n...@wa...> - 2005-05-10 15:52:00
|
Hello Dev-cpp-users, Does anyone have an example of implementing pre-compiled headers in a project, or just a sample which uses pre-compiled headers. Is there a tutorial anywhere? All help appreciated. -- Best regards, Malcolm mailto:m.n...@wa... |
|
From: David M. <dml...@co...> - 2005-05-10 06:12:58
|
To Eesh & Hariyanto. I am really not sure why but the mysql developers do not provide the .a files needed to compile programs with mingw. You have a few options from here: 1. Convert the .lib (MS ViusalC++) libraries to .a (mingw). Relatively simple but long and painful. Disadvantage is that this method can't produce static libraries (which to me kinda nulls out the reason I am using an EMBEDDED server). Som info on the topic can be found at: http://www.synnottsoftware.com/tutorials/mysqlwindows.php http://lists.mysql.com/win32/16919 2. Compile with cygwin (and be eternally dependent on the cygwin dll). Not a bad thing until you start distributing. 3. Cross compile. From what I have heard not a good thing to do in general if you plan to keep your sanity. 4. Build mysql (at least the libs) from scratch writing the makefile yourself (I can tell you right now using the Dev-C++ import MSVC++ project does not work with the project file from mysql). Even if one has a copy of Visual C++ and starting going through the dependency tree by hand you will find so my projects within the workspace that the libraries are dependent on that option 1 actually looks easy). Believe me I tried for a couple hours before getting fed up (I think it had more to do with the fact that I was using Visual Studio .NET) Hope this helps David McKen Hariyanto wrote: >I have error when compile in mysql_com.h, I want to download mysql under window there are 3 file : > >1. Windows Essentials (x86) 4.1.11 14.1M > MD5: dc331a3a3c9b151d3840dd2b4c47ed49 > >2. Windows (x86) 4.1.11 35.1M > MD5: b4b9d56bbf8139197f9c730c96c48595 > >3. Without installer (unzip in C:\) 4.1.11 36.2M > MD5: 6330f744f8a15cd9c3f6a70e023ce563 > >which one I must to download to develop program with glade and dev-cpp. >thx > > |
|
From: Alfred P. R. <al...@ya...> - 2005-05-09 16:47:43
|
Hi All,
This is a response to the linker error messages or the undefined reference error, etc.
Do a search in the dev-c++ folders for the text of the undefined reference. I use grep, so the command would be:
grep -i -r 'mysql_server_init@12' * (or whatever the undefined reference is.) Usually the problem is a library that hasn't been included or that the compiler can't find due to a path problem.
If grep returns nothing, then a file containing that text doesn't exist in the dev-c++ path. If the file is on another path, the properly point the compiler via the dev-c++ project properties windows. Either add it to the compiler parameters sub-window, or place its path in the library path sub-window.
If grep returns with a file name, add that library, however sometimes you'll get more than one library name. Use the most likely library, then. If the actual file name is libsomething.a, add it in the parameters window as -Isomething, not as -Ilibsomething.a. That's a common error that's part of the dev-c++ learning curve. Read the gcc manual to insure that I haven't buggered up with the last statement!
main.o(.text+0x127):main.cpp: undefined reference to `Direct3DCreate9@4' is saying that it can't find that name in the libraries, as that's the format of library reference names, same with the mysql error.
BTW: There's other ways to reset the class browser. I use the show all characters switch in editor options. Pain in the butt. IMHO, I believe that the class browser should rescan automatically whenever a variable is added, or a button should be provided to rescan it. If anybody knows of a simpler way to rescan the class browser, please let us know!
Hope the above helps!
Eesh Modi <ees...@te...> wrote:
I am new at programming in general. But i have written a small windows program that i have been trying to link with MySQL. I have included the mysql.h and mysql_embed.h header files, and have added -lmysqld embedded library for linking. I have also added the path to these files. When I compile my program, I get error messages for all of the MySQL functions in my program.
[Linker error] undefined reference to 'mysql_server_init@12'
[Linker error] undefined reference to 'mysql_init@4'
[Linker error] undefined reference to 'mysql_real_connect@32'
and so on...
What am i doing wrong. If someone could help, I would appreciate it.
Thanks
Eesh
Alfred P. Reaud
|
|
From: <A_B...@gm...> - 2005-05-09 15:06:15
|
Hi, if I add a new class or a new member to a class, the added class/member doesn't show up in the class browser! I add it by right clicking on the class browser... Until I disable the class browser and then enable the browser again (new scan for all classes)... Is there a way to do this scan after every addition (and delete) ??? CU, Acki |
|
From: Matthew T. <mac...@ho...> - 2005-05-09 13:19:07
|
Matthew Thompson wrote:
I am having trouble getting Dev-C++ recognizing the d3dx header files
that come with the DirectX 9 SDK. There are several errors that occur in
these header files which is odd and is not in my control because I don't
want to have to edit these files. Is there a reason for this?
Paste these errors and tell us which wersion of DX9 do you use (and which
devpak - if any).
Regards
Marcin
Sorry, I forgot about those details. I'm using Dev-C++ 5, my computer is
running DirectX 9c and the header files (as I wrote above) came with the SDK
from the microsoft website. I'm using Window XP Home Edition and have
Service Pack 2.
Here is the Compiler Log as well, if it helps.
Compiler: Default compiler
Building Makefile: "E:\Dev-Cpp\My Projects\DirectX\Makefile.win"
Executing make...
make.exe -f "E:\Dev-Cpp\My Projects\DirectX\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"E:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"
-I"E:/Dev-Cpp/include/c++/3.4.2/backward"
-I"E:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"E:/Dev-Cpp/include/c++/3.4.2"
-I"E:/Dev-Cpp/include"
g++.exe main.o -o "DirectX.exe" -L"E:/Dev-Cpp/lib" -mwindows
main.o(.text+0x127):main.cpp: undefined reference to `Direct3DCreate9@4'
collect2: ld returned 1 exit status
make.exe: *** [DirectX.exe] Error 1
Execution terminated
_________________________________________________________________
Sell your car for $9 on carpoint.com.au
http://www.carpoint.com.au/sellyourcar
|
|
From: <ms...@wp...> - 2005-05-09 07:51:44
|
Matthew Thompson wrote: > I am having trouble getting Dev-C++ recognizing the d3dx header files > that come with the DirectX 9 SDK. There are several errors that occur in > these header files which is odd and is not in my control because I don't > want to have to edit these files. Is there a reason for this? Paste these errors and tell us which wersion of DX9 do you use (and which devpak - if any). Regards Marcin |
|
From: Eesh M. <ees...@te...> - 2005-05-09 05:44:14
|
I am new at programming in general. But i have written a small windows =
program that i have been trying to link with MySQL. I have included the =
mysql.h and mysql_embed.h header files, and have added -lmysqld embedded =
library for linking. I have also added the path to these files. When I =
compile my program, I get error messages for all of the MySQL functions =
in my program.
[Linker error] undefined reference to 'mysql_server_init@12'
[Linker error] undefined reference to 'mysql_init@4'
[Linker error] undefined reference to 'mysql_real_connect@32'
and so on...
What am i doing wrong. If someone could help, I would appreciate it.
Thanks
Eesh
=20
|
|
From: dj3d <dj...@ar...> - 2005-05-08 20:02:15
|
Look for lang in german Schaui Dirk |
|
From: Matthew T. <mac...@ho...> - 2005-05-08 13:45:38
|
I am having trouble getting Dev-C++ recognizing the d3dx header files that come with the DirectX 9 SDK. There are several errors that occur in these header files which is odd and is not in my control because I don't want to have to edit these files. Is there a reason for this? _________________________________________________________________ Update your mobile with a hot polyphonic ringtone: http://fun.mobiledownloads.com.au/191191/index.wl?page=191191polyphonicringtone |
|
From: Hariyanto <xho...@te...> - 2005-05-08 04:40:56
|
I have error when compile in mysql_com.h, I want to download mysql under window there are 3 file : 1. Windows Essentials (x86) 4.1.11 14.1M MD5: dc331a3a3c9b151d3840dd2b4c47ed49 2. Windows (x86) 4.1.11 35.1M MD5: b4b9d56bbf8139197f9c730c96c48595 3. Without installer (unzip in C:\) 4.1.11 36.2M MD5: 6330f744f8a15cd9c3f6a70e023ce563 which one I must to download to develop program with glade and dev-cpp. thx |
|
From: Divick K. <div...@re...> - 2005-05-06 08:44:59
|
Hi all,=0A I am trying to compile a simple DLL which calls functi= ons of another DLL, but I get linker errors that some symbols (functions of= other DLL) not found. I have linked to the other DLL like this.=0A=0Amydir= /lib/win32/libmyapi.lib in the linker options and I have added the director= y in which my lib file resides in the "Library Directories" option.=0A=0AIn= dependency walker, all the functions in the dll are being shown properly. = I even used dlltool to export the symbols into a lib file but that also doe= sn't help.=0A=0ADoes any one know how can I fix this problem?=0APlease help= .=0A=0AThanks in Advance,=0ADivick |
|
From: <Mat...@Ve...> - 2005-05-06 00:36:39
|
References are a lot safer than pointers because you don't have as many problems with memory leaks, and a caller can call a reference function and a non-reference function (perhaps you actually do want to copy an input variable because your function corrupts the input deliberately) in the same fashion. Therefore, in general, C++ programmers are strongly encouraged to use references instead of pointers when possible. Often, one finds that it's possible to design equally efficient methods of dealing with your data that do not require pointers, which is a VERY good thing. This is the beauty of container classes. If you pass them as a reference or a constant reference, you can shuffle your data around quickly just like with a pointer, but the ~container destuctor function makes it essentially impossible to leak memory! Just some thoughts, Matthew Hall -----Original Message----- From: dev...@li... [mailto:dev...@li...]On Behalf Of Per Westermark Sent: Thursday, May 05, 2005 5:28 PM To: Jakob EKlund Cc: dev...@li... Subject: Re: [Dev-C++] Pointers references and speed Internally, references and pointers are identical. The change is only in syntax. /Per W On Thu, 5 May 2005, Jakob EKlund wrote: > Is there any known differens in speed between pointers and references? > > //is there any accessspeed difference between > int * pointer; > //and > int &reference; > > Or is there any other complication considering references that I should be > aware about before starting to use them? > > /Jakob Eklund ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ___________________________________________________________________ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. |
|
From: Per W. <pw...@ia...> - 2005-05-06 00:28:17
|
Internally, references and pointers are identical. The change is only in syntax. /Per W On Thu, 5 May 2005, Jakob EKlund wrote: > Is there any known differens in speed between pointers and references? > > //is there any accessspeed difference between > int * pointer; > //and > int &reference; > > Or is there any other complication considering references that I should be > aware about before starting to use them? > > /Jakob Eklund |
|
From: Jakob E. <mai...@ko...> - 2005-05-05 19:56:57
|
Is there any known differens in speed between pointers and references? //is there any accessspeed difference between int * pointer; //and int &reference; Or is there any other complication considering references that I should b= e =20 aware about before starting to use them? /Jakob Eklund |
|
From: Colin L. <ha...@bl...> - 2005-05-05 19:21:14
|
Hello, It is at this page, at the very bottom, you need to enter your subscriber address to enter the configuration page. Greetings, Colin Laplace On Wednesday 04 May 2005 16:38, Piotr 'xavier' Zierhoffer wrote: > Hi! > I have a little question - how can I change receiving mode of this > list? I want to receive messages batched in a daily digest, now I'm > getting every single message in separate e-mail... Is it possible? I > couldn't find any kind of config-panel on > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users... > > Thanks in advance > Piotr Zierhoffer > > P.S. Sorry, english is not my first language :) |
|
From: Per W. <pw...@ia...> - 2005-05-03 15:16:45
|
Are you asking about actual Dev-C++ tools, or are you thinking about the MinGW tools, i.e. the port of the GNU compiler, linker, make etc? /Per W On Mon, 2 May 2005, Alexsandro Meireles wrote: > Hi, all! > I've been working with Dev-C++ and finding it great, but I couldn't find > any good tutorial explaining all program possibilities. Does anyone know any > tutorial explaining how to use Dev-C++ tools? > Thanks in advance! > > -- > Alexsandro Meireles > |
|
From: Alexsandro M. <mei...@gm...> - 2005-05-03 14:53:34
|
Hi, all! I've been working with Dev-C++ and finding it great, but I couldn't find= =20 any good tutorial explaining all program possibilities. Does anyone know an= y=20 tutorial explaining how to use Dev-C++ tools? Thanks in advance! --=20 Alexsandro Meireles |
|
From: Szczepan H. <ru...@wp...> - 2005-05-03 11:31:27
|
> Just a suggestion to your algorithm in
> order to not use an "if/else" statement.
<snip>
> for(double i = 3; i < 999999999; i+=2)
> {
> sign *= -1;
> PI += ((numerator/i)*sign);
> }
... and since an assignment expression itself has a value equal to the
value assigned, this may be rewritten as a one-liner without curly
braces:
for(double i = 3; i < 999999999; i+=2)
PI+=((numerator/i)*(sign = -sign));
Note that "sign = -sign" might be more efficient if your compiler
cannot optimize multiplication by -1 to a single FP negate instruction
to avoid full FP multiplication.
Another optimization is to factor out the sign switching altogether.
You could increment the loop by 4 instead of 2 and add two terms in
one iteration:
for(double i = 3; i < 999999999; i+=4)
PI += -numerator/i + numerator/(i+2);
This method reduces the number of loop iterations by two. This is an
additional benefit because each loop iteration involves a conditional
branch, and conditional branches are bad for performance on modern
CPUs.
(Note that the result might be slightly different now because of an
off-by-one issue: you might be adding an extra term in the last
iteration because the "(i+2)" is no longer checked against the loop
exit condition.)
BTW., I didn't know that PI could be calculated like this! From what I
know about harmonic series it must converge painfully slowly, hence
999999999... :)
Regards,
Szczepan Holyszewski
|
|
From: Verne H. B. <ve...@sy...> - 2005-05-02 18:34:38
|
Need more here. Explain a little more of what you are trying to do and what you did to this point. Verne > when i try to open a new project, there aren't any options available in the > basic file, although the multimedia and others have options. how come? > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. > Get your fingers limbered up and give it your best shot. 4 great events, 4 > opportunities to win big! Highest score wins.NEC IT Guy Games. Play to > win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Celine L. <lil...@ho...> - 2005-05-02 18:20:40
|
when i try to open a new project, there aren't any options available in the basic file, although the multimedia and others have options. how come? |
|
From: <Mat...@Ve...> - 2005-05-02 18:00:41
|
I believe that if somebody had, they would have answered by now. -----Original Message----- From: dev...@li... [mailto:dev...@li...]On Behalf Of Guillermo Gutierrez Sent: Monday, May 02, 2005 8:48 AM To: dev...@li... Subject: RE: [Dev-C++] SHFILEOPSTRUCT - WIN32 API Has anyone ever used this WIN32 Shell API struct? -----Original Message----- From: dev...@li... [mailto:dev...@li...]On Behalf Of Guillermo Gutierrez Sent: Friday, April 29, 2005 4:53 AM To: dev...@li... Subject: [Dev-C++] SHFILEOPSTRUCT - WIN32 API Has anyone ever used the Shell object struct SHFILEOPSTRUCT for any shell operations (copy, delete, move) for files in windows? I am having trouble getting it to work with copying multiple files that are named individually instead of just using a wild card (*.*) to select all files. I would really appreciate any help and suggestions incase anyone has done something similar through another method? Guillermo Gutierrez Market Scan Information Systems Software Q.A. Supervisor (818) 575-2000 x2427 ggu...@ma... ___________________________________________________________________ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. |
|
From: Guillermo G. <ggu...@ma...> - 2005-05-02 15:52:38
|
Has anyone ever used this WIN32 Shell API struct? -----Original Message----- From: dev...@li... = [mailto:dev...@li...]On Behalf Of Guillermo = Gutierrez Sent: Friday, April 29, 2005 4:53 AM To: dev...@li... Subject: [Dev-C++] SHFILEOPSTRUCT - WIN32 API Has anyone ever used the Shell object struct SHFILEOPSTRUCT for any = shell operations (copy, delete, move) for files in windows? I am having trouble getting it to work with copying multiple files that = are named individually instead of just using a wild card (*.*) to select = all files. I would really appreciate any help and suggestions incase anyone has = done something similar through another method?=20 Guillermo Gutierrez=20 Market Scan Information Systems=20 Software Q.A. Supervisor=20 (818) 575-2000 x2427=20 ggu...@ma...=20 |
|
From: Per W. <pw...@ia...> - 2005-05-02 05:37:51
|
As you notice, it isn't so common to use only string literals, so most
often, dynamic memory is used.
It is a bad idea to create an array where some items are dynamically
allocated followed by a string-copy, and some entries are assignments of
pointers to string literals. The problem will be how to - in a portable
way - know which entries that requires release of dynamic memory.
However, the string literal method do have it's uses. Think for example
keywords for a computer language. All the keywords are know before, and to
speed up operation, the compiler may convert from a list of keywords to a
heavily optimized construct to maximize search time - for example a
perfect hash, where no keyword bin collides with any other keyword bin.
/Per W
On Mon, 2 May 2005, Rafael Charnovscki wrote:
> Per Westermark wrote:
> >
> > However, the above two alternatives may not be combined into:
> > array[1] = malloc(strlen(sentence)+1);
> > array[1] = "sentence";
> > since the second assign will loose the reference to the memory previously
> > allocated.
> >
> Per,
> Thank you for remind us that!
> Do you think it's safe using array[n]="string_literal" inside
> functions?
>
> <snip>
> void foo (char *array[]){
> array[0]="string_literal_1";
> ...
> array[n]="string_literal_n";
> }
> </snip>
>
> IMHO, for C code I'd use dynamic allocation with strings, since
> it's not very common having only string literals. I mean, you don't
> know exactly what you'll have, so you'll have to allocate memory.
>
> Regards,
> Rafael
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 29/04/05
>
|
|
From: Rafael C. <cha...@un...> - 2005-05-02 03:21:03
|
Per Westermark wrote:
>
> However, the above two alternatives may not be combined into:
> array[1] = malloc(strlen(sentence)+1);
> array[1] = "sentence";
> since the second assign will loose the reference to the memory previously
> allocated.
>
Per,
Thank you for remind us that!
Do you think it's safe using array[n]="string_literal" inside
functions?
<snip>
void foo (char *array[]){
array[0]="string_literal_1";
...
array[n]="string_literal_n";
}
</snip>
IMHO, for C code I'd use dynamic allocation with strings, since
it's not very common having only string literals. I mean, you don't
know exactly what you'll have, so you'll have to allocate memory.
Regards,
Rafael
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 29/04/05
|