Saturday, September 30, 2017

Digest for comp.lang.c++@googlegroups.com - 11 updates in 5 topics

woodbrian77@gmail.com: Sep 30 03:49PM -0700

> Unfortunately, string_view wasn't introduced years ago. I hope compiler
> vendors will take a "better late than never" attitude toward string_view
> and make it available with their C++ 2011 and 2014 compilers.
 
In this talk Titus Winters says they are going
to "pre-adopt" string_view into a library they're
developing:
 
https://duckduckgo.com/?q=cppcon+videos&atb=v72-1__&ia=videos&iax=1&iai=tISy7EJQPzI
 
(around the 49 minutes and 40 seconds mark)
 
This is further indication of the need for this
support for people using C++ 2011 compilers and I
hope compiler vendors will do the porting themselves.
 
 
Brian
Ebenezer Enterprises - Enjoying programming again.
http://webEbenezer.net
Ivan Shmakov <ivan@siamics.net>: Sep 30 07:05PM

>>>>> red floyd <dont.bother@its.invalid> writes:
>>>>> On 9/29/2017 12:24 PM, Chris M. Thomasson wrote:
 
[...]
 
>> Perhaps, you should create an online CAlive compiler. I can go to
>> your site, type in my program, hit compile and see output.
 
> But it won't allow constants that equal 666.
 
Not much different to how some countries won't allow 13th floors,
I guess.
 
[...]
 
--
FSF associate member #7257 http://am-1.org/~ivan/ 7D17 4A59 6A21 3D97 6DDB
fir <profesor.fir@gmail.com>: Sep 30 03:43AM -0700

i once said i was coding some library for win32
that grants acces to making easy (old school in spirit)
per pixel graphics apps in windows (win32)
 
i was quite not touched it for 2 years or so but its functional and i am quite pleased by that lib though it is
not polished and even in design state as o some elements
 
you may check some example how to use it
 
minddetonator.htw.pl/gfe.zip
 
you need windows and mngw installed and thats all
here i showed how with few lines of code you cold create a windows and make something like small raw paint
appplication
 
this code is
 
 
#include<windows.h>
 
#include "green-fire.h"
 
int background_color = 0x00400020;
int drawing_color = 0xffffff;
 
int pen_size = 5;
 
void RunFrame(int no_advance)
{
 
if(frame_number==0)
ClearFrameData(background_color);
 
 
if(lmb_pressed)
FillCircle( mouse_x, mouse_y, pen_size, drawing_color);
 
if(rmb_pressed)
FillCircle( mouse_x, mouse_y, pen_size, background_color);
 
 
}
 
void ProcessMouseMove(int x, int y)
{
 
 
}
 
void ProcessKeyDown(int key)
{
if(key=='1') drawing_color = 0x00ffffff;
if(key=='2') drawing_color = 0x00551188;
if(key=='3') drawing_color = 0x00115088;
if(key=='4') drawing_color = 0x0015e078;
if(key=='5') drawing_color = 0x00256048;
if(key=='6') drawing_color = 0x00358098;
if(key=='7') drawing_color = 0x00e5c098;
if(key=='8') drawing_color = 0x003530a8;
if(key=='9') drawing_color = 0x0085c0f8;
 
 
if(key==VK_SPACE)
SaveFrameAsBMP("saved.bmp");
 
}
 
void OnResize()
{
 
RunFrame(1);
 
}
 
 
 
int main(void)
{
SetupWindow(" fir's Green fire usage example ", "2D", "notrace", 515, 415, 30, 20, RunFrame, 9, OnResize, ProcessMouseMove, ProcessKeyDown);
 
return 0;
}
 
 
separate topic is in fact i could and should to redesign it a bit (removing windows.h dependency (which is slight and probably not needed) and redesign the callbacks maybe for better usage
 
 
my goal (which probably fail as i know life though its good imo) would be to interest some people here to write some per pixel snippets and make some fun of it , mayb some contests and discussion (the contexts and discusion based on console are boring and my ap makes coding per pixel c snippeds real easy and potential fun is quite big)
fir <profesor.fir@gmail.com>: Sep 30 04:31AM -0700

getting back to design : here above for example i set all window info in a bit chaotic way, i think this info could be divided on windows setting and callbacks (i also get this needed calbasks set quite limited as it shows)
 
so i think maybe i should do
 
int main()
{
//...
 
SetupWindow(window_settings, window_callbacks);
ret 0;
}
 
 
where
 
int main()
{
WindowSettings ws;
 
ws.title = "firs example app over green fire lib" ;
 
ws.pos_x = 20;
ws.pos_y = 20;
ws.size_x = 400;
ws.size_y = 300;
 
ws.mode3d = 0;
ws.trace_info = 0;
 
WindowCallbacks wc;

wc.RunFrame = RunFrame;
wc.MouseMove = ProcesMouseMove;
wc.KeyDown = OnKeyDown;
wc.Resize = OnResize;
 
 
SetupWindow(window_settings, window_callbacks);
ret 0;
}
 
quite longer though, other alternative is to hide structures and give some api calls to set it
 
int main()
{
 
SetWindowsTitle("firs example app over green fire lib") ;
 
SetWindowSize(20, 30, 400, 300);
SetWindowMode3d(0);
SetWindowTraceInfoOn(0);
 
SetRunFrameCallback(RunFrame);
SetMouseMoveCallback(ProcesMouseMove);
SetKeydawnCallback(OnKeyDown);
SetOnResize Callback(OnResize);
 
SetupWindow();
 
ret 0;
}
 
there is also posible a mix of this options - which one is the best here?
asetofsymbols@gmail.com: Sep 29 11:39PM -0700

If we have a class rc
For rc there is a constructor that
request memory from heap
 
Whap happen to this code at end of loop if the return statement is not executed? This code would/should compile?
 
rc f(rc v)
{int j;
for(j=0;j<100;++j)
if(operation(j))
{opera(&v);return v}
}
asetofsymbols@gmail.com: Sep 29 11:50PM -0700

I say this because it seems that code (if I write some other ;)
compile run and when it return out from the loop : return one obj not ok at last the free() function I use says this
Barry Schwarz <schwarzb@dqel.com>: Sep 30 12:20AM -0700

On Fri, 29 Sep 2017 23:39:47 -0700 (PDT), asetofsymbols@gmail.com
wrote:
 
> if(operation(j))
> {opera(&v);return v}
>}
 
With the right set of options, your compiler should warn you that
there is a return path from f that does not return a value.
 
After executing a statement like
x = f(...);
any attempt to evaluate the value of x causes undefined behavior when
all executions of the if statement evaluate as false.
 
--
Remove del for email
Barry Schwarz <schwarzb@dqel.com>: Sep 30 12:27AM -0700

On Fri, 29 Sep 2017 23:50:23 -0700 (PDT), asetofsymbols@gmail.com
wrote:
 
>I say this because it seems that code (if I write some other ;)
>compile run and when it return out from the loop : return one obj not ok at last the free() function I use says this
 
If that incomprehensible sentence means free reports that the value is
not one that was returned by an appropriate allocation function, that
makes perfect sense. After 100 iterations of your for loop never
executing the return statement, the function exits without returning a
value. Attempting to evaluate the non-existent returned value causes
undefined behavior.
 
In practical terms, the value your calling function receives will
probably be whatever residual bit pattern was left in the stack where
the returned value would have been placed by a return statement. It
is extremely unlikely that this value is one that free can process
properly.
 
--
Remove del for email
asetofsymbols@gmail.com: Sep 30 12:47AM -0700

Barry wrote:
After executing a statement like
x = f(...);
any attempt to evaluate the value of x causes undefined behavior when
all executions of the if statement evaluate as false
 
---------
Yes as above ok..
in x=f(a) in what I would know: f return one obj , = is executed, than would be called the destructor for tmp obj (returned from f)
than the function that free the memory to the heap, free() says that the pointer is not right and it stop the program. I not understand why compile has to emit only one warning for that and not one error (at last for class obj)
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Sep 29 09:10PM -0700

On 9/28/2017 11:25 PM, Öö Tiib wrote:
 
>> Bait?
 
> His madness. The invisible pink unicorns are magical because how else
> those can be invisible and pink at same time?
 
If one of the invisible unicorns tells you it is pink... Is it lying?
 
;^)
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Sep 29 09:19PM -0700

On 9/29/2017 9:10 AM, red floyd wrote:
 
>> His madness. The invisible pink unicorns are magical because how else
>> those can be invisible and pink at same time?
 
> Heresy!!   All know that the IPU is phony, while the FSM is real!
IPU is the one true way, FSM is crap. Give me the right amount of $$$
and I will send you the real deal, top-secret documents that will blow
your mind. People that worship the FSM are most likely possessed by the
demon lord Jeearr:
 
https://www.thezorklibrary.com/history/jeearr.html
 
lol.
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: