Vir Campestris <vir.campestris@invalid.invalid>: Dec 08 09:33PM On 07/12/2019 06:36, Tim Rentsch wrote: > accessing, "bytes" within a word, and instructions for doing loads, > stores, and pointer arithmetic in terms of "bytes" rather than > words. You obviously remember it better than I do. OTOH I was supposed to be studying Biology... Andy |
Soviet_Mario <SovietMario@CCCP.MIR>: Dec 08 12:29AM +0100 Il 07/12/19 23:30, Paavo Helde ha scritto: >> exact extent, >> they are asciiZ '\0' terminated for support of std functions) > So, reinventing std::string. Why? no it's not : all stuff static or automatic, no malloc, no new operator, no throw and so. At the cost of waste of space (and negligible limitation due to natural fields size). >> int numRows, int numCols); > What's this obsession with backslashes and line > continuation? It's not needed beyond macro definitions. how in the NG is to be reported line continuation ? Underscore ? >> from Table <FixedString> to Table <double> >> from Table <FixedString> to Table <FixedString> > So, every FixedString will be convertible to double? all "selected" columns contain convertible data potentially converted (all or part). All other columns contain textual data to never be converted (nor extracted). If sth goes wrong it is not a design error but a user error, trapped as such and suggesting to correct the selection. > What > happens if it is an empty string or "abc"? throws an exception. In a grid some columns are processable for calculations, others are Date-time, name, surname, class/section and so. Only properly selected columns are extracted back and forth. > If it is > restricted to be numeric why don't you hold everything in > double ? to have allow for an homogeneous complete table (a single matrix of data) holding also textual data. The "work" temporaries are actually of the Table <double> kind, for calculations. But later are reinserted back in initial positions. Otherwise a table could be "order" dependent, which I don't like. Numeric data can be placed in whichever order amongst textual data (on a column basis). Plus some replicated header rows (one per each class, I mean a school class here not the C++ keywords). I would not want a "variant-like" cell, with a further field holding its type .... but this is not completely excluded though. With a union it could be done limiting the waste. To start with I have chosen to have either FixedStrings or double cells. The selection is done intersecating a list of active columns and same-class rows. All selected columns are expected to hold numeric data. The Table <double> is generated from extraction, then calculations. Than back-exported in textual complete table for logging as text file report. Again, I am translating an existing program in Gambas, but with no particular restraints : the two are not expected to exchange data. I am simply trying to port all from scratch to C++. Well, I could maintain a skeleton of Gambas just as a wrapper to prepare some files and to set options to pass to C++ program, as a script file, not a very tight interaction. > complex than your design which attempts to do two things at > once. > When you have got this working and the customer is not no there is not any customer. I am just trying to "translate" a facility for personal use to C++, but not for performance reason. The SW has grown to a size I have difficulty maintaining in gambas. Always the same problem. C++ forces me to be more tidy, when I manage to understand well the synthax at least. >> Table <tt> :: ExtractSubTable \ >> (int * SelectedRowList, int * SelectedColumnList, \ > Weird backslash obsession again... what about the synthax rather ? I dunno how to write a proper declaration.... -- 1) Resistere, resistere, resistere. 2) Se tutti pagano le tasse, le tasse le pagano tutti Soviet_Mario - (aka Gatto_Vizzato) |
"Öö Tiib" <ootiib@hot.ee>: Dec 07 03:39PM -0800 On Sunday, 8 December 2019 01:29:22 UTC+2, Soviet_Mario wrote: > > continuation? It's not needed beyond macro definitions. > how in the NG is to be reported line continuation ? > Underscore ? You mean that you broke line to keep your posting line length under 70 symbols and want to indicate it? Unsure about others but when result compiles without those backslashes then I read it better when you do not indicate it at all. |
Soviet_Mario <SovietMario@CCCP.MIR>: Dec 08 01:43AM +0100 Il 08/12/19 00:39, Öö Tiib ha scritto: >> Underscore ? > You mean that you broke line to keep your posting line length under > 70 symbols and want to indicate it? I tried to broke down parts "logically" as much as possible, but the arglist was too long all the same. > Unsure about others > but when result compiles without those backslashes then I read it > better when you do not indicate it at all. ok ... -- 1) Resistere, resistere, resistere. 2) Se tutti pagano le tasse, le tasse le pagano tutti Soviet_Mario - (aka Gatto_Vizzato) |
"Öö Tiib" <ootiib@hot.ee>: Dec 07 04:46PM -0800 On Saturday, 7 December 2019 22:06:17 UTC+2, Soviet_Mario wrote: > tgtCol = SelectedColList [Col]; > // will operator = be chosen properly ? > RetVal.Dati [Row] [Col] = Dati [tgtRow] [tgtCol]; I trust it will. > the declarators is tempted completely random, please explain > me the order of nesting, or even if a multiple template (I > believe not) like template <tt, xx> is due I do not understand where you said what is wrong with it. > and also, how to generate the four specialized > ExtractSubTable functions ? Since C++ cant deduce what you want to call you need to explicitly instantiate othervar = tablevar.ExtractSubTable<FixedString>(a,b,c,d); > I am confused in nested templates; > tnx See <https://en.cppreference.com/w/cpp/language/member_template> for simple reference. > How to produce all four I dislike implicit conversions even between close enough types like double and int. Sometimes tiny typos compile because of it, are hard to notice in longer expressions, cause confusion about what went wrong and so slow down programming. Fortunately compilers have started to warn about those. But your idea of user defined implicit conversions between double and string feel like deliberately adding that kind of pain to yourself. |
Soviet_Mario <SovietMario@CCCP.MIR>: Dec 08 12:15PM +0100 Il 08/12/19 01:46, Öö Tiib ha scritto: > See > <https://en.cppreference.com/w/cpp/language/member_template> > for simple reference. TNX, I'm going reading > Fortunately compilers have started to warn about those. But your > idea of user defined implicit conversions between double and string > feel like deliberately adding that kind of pain to yourself. well, as the two types are not implicitely convertible at all, every conversion must pass through the operators I have manually coded, so it is not actually "implicit". Operators fail and throw an exception if a FixedString does not hold a valid double textual representation as recognized by scanf for example or strtod. But this originates by a wrong selection of columns on which to work or by wrong input by user, the program cannot do anything except signalling it -- 1) Resistere, resistere, resistere. 2) Se tutti pagano le tasse, le tasse le pagano tutti Soviet_Mario - (aka Gatto_Vizzato) |
"Öö Tiib" <ootiib@hot.ee>: Dec 08 04:38AM -0800 On Sunday, 8 December 2019 13:15:41 UTC+2, Soviet_Mario wrote: > well, as the two types are not implicitely convertible at > all, every conversion must pass through the operators I have > manually coded, so it is not actually "implicit". There are no difference really if implicit conversions are written by programmer or inbuilt into language. Programmer needs to make those explicit explicitly by using keyword "explicit". ;) > Operators fail and throw an exception if a FixedString does > not hold a valid double textual representation as recognized > by scanf for example or strtod. The nature of problem is not about processing data wrongly by mistake of end user but programmer doing typos. The more there are conversions the more there are chances that something can be misused in wrong role in code by typo. Typo like adding something not to array element but to pointer into what array itself did decay. When programmer runs it and sees that something is wrong then he sometimes stares half an hour at code since there were no warnings. > But this originates by a wrong selection of columns on which > to work or by wrong input by user, the program cannot do > anything except signalling it That is usual case. When I let user to index something I use the at() member of containers for to have exception to report when they violate bounds. But it wasn't what I meant. |
Paavo Helde <myfirstname@osa.pri.ee>: Dec 08 02:59PM +0200 On 8.12.2019 1:29, Soviet_Mario wrote: > no it's not : all stuff static or automatic, no malloc, no new operator, > no throw and so. At the cost of waste of space (and negligible > limitation due to natural fields size). OK, I was somehow thinking you are trying to do short string optimization. >> needed beyond macro definitions. > how in the NG is to be reported line continuation ? > Underscore ? URL-s can be enclosed in <..> or "..". For other stuff it's not so important to fit onto a single line. Large C++ statements naturally span multiple lines, no backslash is needed. A semicolon typically marks the end of the statement. > I would not want a "variant-like" cell, with a further field holding its > type .... but this is not completely excluded though. With a union it > could be done limiting the waste. If you need to check at run-time whether something is a double or a string, then you need to have something present at run-time what you can check. Sorry, this is the "further field holding its type", you just cannot avoid that. You can have a single field for the whole table though, if the table is guaranteed to be homogeneous. > same-class rows. All selected columns are expected to hold numeric data. > The Table <double> is generated from extraction, then calculations. Than > back-exported in textual complete table for logging as text file report. [...] > problem. > C++ forces me to be more tidy, when I manage to understand well the > synthax at least. If you want to have simple program for better maintenance, then that's one more argument for the simpler solution I proposed: step 1, extract subtable; step 2, convert it into needed type. No need to do everything at once. |
Paavo Helde <myfirstname@osa.pri.ee>: Dec 08 04:53PM +0200 On 8.12.2019 14:59, Paavo Helde wrote: > one more argument for the simpler solution I proposed: step 1, extract > subtable; step 2, convert it into needed type. No need to do everything > at once. On further pondering, I have not seen anything so far which would require the type of the table being unknown at compile time. So your wish to represent the table in a single class regardless of the data type does not seem reasonable. If I were you, I would just use two separate classes, e.g. std::vector<double> and std::vector<std::string>, maybe with some slight wrappers for emulating 2D access, and be done with it. |
Soviet_Mario <SovietMario@CCCP.MIR>: Dec 08 07:47PM +0100 On 08/12/19 15:53, Paavo Helde wrote: > would require the type of the table being unknown at compile > time. So your wish to represent the table in a single class > regardless of the data type does not seem reasonable. I agree with you (I just thought it before) from the program point of view. From the "writer" of the code, well, too boring duplicate almost identical code with just a few specific features. I wanted the templating mechanism to do this for me, just that. But I am now also reconsidering the variant-like "union" unique cell type, able to hold both a double and a FixedString. The fitting code would just reside in this base type of building block, transparent for the container (which would no longer be a template then, or maybe just to size the table max_rows / max_columns > If I were you, I would just use two separate classes, e.g. well, but isn'it so boring to recode by hand two twin types ? -- 1) Resistere, resistere, resistere. 2) Se tutti pagano le tasse, le tasse le pagano tutti Soviet_Mario - (aka Gatto_Vizzato) |
Paavo Helde <myfirstname@osa.pri.ee>: Dec 08 09:00PM +0200 On 8.12.2019 20:47, Soviet_Mario wrote: > view. From the "writer" of the code, well, too boring duplicate almost > identical code with just a few specific features. > I wanted the templating mechanism to do this for me, just that. I said two classes, not two class templates. If it makes sense, by all means, you can code both classes as a single template. When instantiated with different types, they become two different classes though. > or maybe just to size the table max_rows / max_columns >> If I were you, I would just use two separate classes, e.g. > well, but isn'it so boring to recode by hand two twin types ? std::vector is already coded, so there is nothing to get bored about. |
legalize+jeeves@mail.xmission.com (Richard): Dec 08 04:21AM [Please do not mail me a copy of your followup] gazelle@shell.xmission.com (Kenny McCormack) spake the secret code >P.S. People often talk as if C# was invented by itself, as a standalone >language. In fact, C# is just one member of the .NET/CLR family. I think >of VB.NET as the primary .NET language. I suppose C# comes next after VB. .NET is really just COM 2.0. Everything MS learned about binary components with the huge success of COM was refined and made easier with .NET/C#. Many times I have heard people say "C# is just a clone of Java". So far every single one of those people has been someone who hadn't done any significant programming on the Windows platform either before or after the introduction of .NET. While .NET/C# shares some ideas with Java, I dispute the idea that it is just a clone/copy of Java. The idea of programming to a virtual machine was around long before Java. The IBM AS/400 is one obvious example that predates Java. So this was not an invention that came from Java. Remove the JVM and what you're left with is another OO curly brace style language, so that also wasn't some kind of unique invention that originates with Java. Having done jobs where I did ~5 years of programming in both languages, I find it much more pleasant to work in C# than to work in Java. The only thing that was a pleasure while working in Java was using IntelliJ for it's awesome refactoring and navigation capabilities. -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Terminals Wiki <http://terminals-wiki.org> The Computer Graphics Museum <http://computergraphicsmuseum.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment